MCPcopy Index your code
hub / github.com/RustPython/RustPython / AllTests

Class AllTests

Lib/test/test_typing.py:10855–10899  ·  view source on GitHub ↗

Tests for __all__.

Source from the content-addressed store, hash-verified

10853
10854
10855class AllTests(BaseTestCase):
10856 """Tests for __all__."""
10857
10858 def test_all(self):
10859 from typing import __all__ as a
10860 # Just spot-check the first and last of every category.
10861 self.assertIn('AbstractSet', a)
10862 self.assertIn('ValuesView', a)
10863 self.assertIn('cast', a)
10864 self.assertIn('overload', a)
10865 # Context managers.
10866 self.assertIn('ContextManager', a)
10867 self.assertIn('AsyncContextManager', a)
10868 # Check that former namespaces io and re are not exported.
10869 self.assertNotIn('io', a)
10870 self.assertNotIn('re', a)
10871 # Spot-check that stdlib modules aren't exported.
10872 self.assertNotIn('os', a)
10873 self.assertNotIn('sys', a)
10874 # Check that Text is defined.
10875 self.assertIn('Text', a)
10876 # Check previously missing classes.
10877 self.assertIn('SupportsBytes', a)
10878 self.assertIn('SupportsComplex', a)
10879
10880 def test_all_exported_names(self):
10881 # ensure all dynamically created objects are actualised
10882 for name in typing.__all__:
10883 getattr(typing, name)
10884
10885 actual_all = set(typing.__all__)
10886 computed_all = {
10887 k for k, v in vars(typing).items()
10888 # explicitly exported, not a thing with __module__
10889 if k in actual_all or (
10890 # avoid private names
10891 not k.startswith('_') and
10892 # there's a few types and metaclasses that aren't exported
10893 not k.endswith(('Meta', '_contra', '_co')) and
10894 not k.upper() == k and
10895 # but export all things that have __module__ == 'typing'
10896 getattr(v, '__module__', None) == typing.__name__
10897 )
10898 }
10899 self.assertSetEqual(computed_all, actual_all)
10900
10901
10902class TypeIterationTests(BaseTestCase):

Callers 5

testInitMethod · 0.85
testBinaryOpsMethod · 0.85
testListAndDictOpsMethod · 0.85
testUnaryOpsMethod · 0.85
testMiscMethod · 0.85

Calls

no outgoing calls

Tested by 5

testInitMethod · 0.68
testBinaryOpsMethod · 0.68
testListAndDictOpsMethod · 0.68
testUnaryOpsMethod · 0.68
testMiscMethod · 0.68