(self)
| 906 | self.assertNotIsSubclass(CoroLike, Coroutine) |
| 907 | |
| 908 | def test_Hashable(self): |
| 909 | # Check some non-hashables |
| 910 | non_samples = [bytearray(), list(), set(), dict()] |
| 911 | for x in non_samples: |
| 912 | self.assertNotIsInstance(x, Hashable) |
| 913 | self.assertNotIsSubclass(type(x), Hashable) |
| 914 | # Check some hashables |
| 915 | samples = [None, |
| 916 | int(), float(), complex(), |
| 917 | str(), |
| 918 | tuple(), frozenset(), |
| 919 | int, list, object, type, bytes() |
| 920 | ] |
| 921 | for x in samples: |
| 922 | self.assertIsInstance(x, Hashable) |
| 923 | self.assertIsSubclass(type(x), Hashable) |
| 924 | self.assertRaises(TypeError, Hashable) |
| 925 | # Check direct subclassing |
| 926 | class H(Hashable): |
| 927 | def __hash__(self): |
| 928 | return super().__hash__() |
| 929 | self.assertEqual(hash(H()), 0) |
| 930 | self.assertNotIsSubclass(int, H) |
| 931 | self.validate_abstract_methods(Hashable, '__hash__') |
| 932 | self.validate_isinstance(Hashable, '__hash__') |
| 933 | |
| 934 | def test_AsyncIterable(self): |
| 935 | class AI: |
nothing calls this directly
no test coverage detected