diff --git a/docs/changelog.md b/docs/changelog.md index 13797b17..945ffefb 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -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) diff --git a/pyanalyze/stubs/_pyanalyze_tests-stubs/cdata.pyi b/pyanalyze/stubs/_pyanalyze_tests-stubs/cdata.pyi new file mode 100644 index 00000000..d5fda4e7 --- /dev/null +++ b/pyanalyze/stubs/_pyanalyze_tests-stubs/cdata.pyi @@ -0,0 +1,3 @@ +import ctypes + +def f() -> ctypes._CData: ... diff --git a/pyanalyze/test_typeshed.py b/pyanalyze/test_typeshed.py index 6c68a408..dc78f3fa 100644 --- a/pyanalyze/test_typeshed.py +++ b/pyanalyze/test_typeshed.py @@ -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):