Skip to content

Commit d374db2

Browse files
committed
Add basic pygame.typing unit test
1 parent 8ee07ff commit d374db2

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

test/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ test_files = files(
5050
'time_test.py',
5151
'touch_test.py',
5252
'transform_test.py',
53+
'typing_test.py',
5354
'version_test.py',
5455
'video_test.py',
5556
'window_test.py',

test/typing_test.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import unittest
2+
3+
# A basic unit test to test that pygame.typing can import in python code, and
4+
# the documented attributes are accessible.
5+
# More rigorous testing needs mypy and is therefore implemented in the stubs
6+
# directory.
7+
TYPING_PUBLIC_ATTRS = [
8+
"RectLike",
9+
"SequenceLike",
10+
"FileLike",
11+
"ColorLike",
12+
"Point",
13+
"IntPoint",
14+
]
15+
16+
17+
class TypingTest(unittest.TestCase):
18+
def test_typing_has_attrs(self):
19+
import pygame.typing
20+
21+
for i in TYPING_PUBLIC_ATTRS:
22+
self.assertTrue(hasattr(pygame.typing, i))
23+
24+
25+
if __name__ == "__main__":
26+
unittest.main()

0 commit comments

Comments
 (0)