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