Skip to content

Commit

Permalink
Adjust tests for new typeshed_client (#694)
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra committed Sep 30, 2023
1 parent 451ceee commit b05bdad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
2 changes: 2 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Fix tests to account for new `typeshed_client` release
(#694)
- Partial support for PEP 695-style type aliases (#690)
- Add option to disable all error codes (#659)
- Add hacky fix for bugs with hashability on type objects (#689)
Expand Down
3 changes: 3 additions & 0 deletions pyanalyze/stubs/_pyanalyze_tests-stubs/cdata.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ctypes

def f() -> ctypes._CData: ...
20 changes: 3 additions & 17 deletions pyanalyze/test_typeshed.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,24 +255,10 @@ def test_typeddict(self):

@assert_passes()
def test_cdata(self):
import array
import mmap
import pickle

def capybara():
from _typeshed import ReadableBuffer

def inner(b: ReadableBuffer):
assert_is_value(
b,
TypedValue(bytes)
| TypedValue(bytearray)
| TypedValue(memoryview)
| GenericValue(array.array, [AnyValue(AnySource.explicit)])
| TypedValue(mmap.mmap)
| TypedValue("ctypes._CData")
| TypedValue(pickle.PickleBuffer),
)
from _pyanalyze_tests.cdata import f

assert_is_value(f(), TypedValue("_ctypes._CData"))

@assert_passes()
def test_ast(self):
Expand Down

0 comments on commit b05bdad

Please sign in to comment.