Skip to content

Commit

Permalink
Add basic pygame.typing unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ankith26 committed Oct 6, 2024
1 parent 16a8fd0 commit 0fe5fdc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ test_files = files(
'time_test.py',
'touch_test.py',
'transform_test.py',
'typing_test.py',
'version_test.py',
'video_test.py',
'window_test.py',
Expand Down
26 changes: 26 additions & 0 deletions test/typing_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import unittest

# A basic unit test to test that pygame.typing can import in python code, and
# the documented attributes are accessible.
# More rigorous testing needs mypy and is therefore implemented in the stubs
# directory.
TYPING_PUBLIC_ATTRS = [
"RectLike",
"SequenceLike",
"FileLike",
"ColorLike",
"Point",
"IntPoint",
]


class TypingTest(unittest.TestCase):
def test_typing_has_attrs(self):
import pygame.typing

for i in TYPING_PUBLIC_ATTRS:
self.assertTrue(hasattr(pygame.typing, i))


if __name__ == "__main__":
unittest.main()

0 comments on commit 0fe5fdc

Please sign in to comment.