(self)
| 1936 | nativeseq, seqseq, (letter, start, stop)) |
| 1937 | |
| 1938 | def test_ByteString(self): |
| 1939 | previous_sys_modules = sys.modules.copy() |
| 1940 | self.addCleanup(sys.modules.update, previous_sys_modules) |
| 1941 | |
| 1942 | for module in "collections", "_collections_abc", "collections.abc": |
| 1943 | sys.modules.pop(module, None) |
| 1944 | |
| 1945 | with self.assertWarns(DeprecationWarning): |
| 1946 | from collections.abc import ByteString |
| 1947 | for sample in [bytes, bytearray]: |
| 1948 | with self.assertWarns(DeprecationWarning): |
| 1949 | self.assertIsInstance(sample(), ByteString) |
| 1950 | self.assertTrue(issubclass(sample, ByteString)) |
| 1951 | for sample in [str, list, tuple]: |
| 1952 | with self.assertWarns(DeprecationWarning): |
| 1953 | self.assertNotIsInstance(sample(), ByteString) |
| 1954 | self.assertFalse(issubclass(sample, ByteString)) |
| 1955 | with self.assertWarns(DeprecationWarning): |
| 1956 | self.assertNotIsInstance(memoryview(b""), ByteString) |
| 1957 | self.assertFalse(issubclass(memoryview, ByteString)) |
| 1958 | with self.assertWarns(DeprecationWarning): |
| 1959 | self.validate_abstract_methods(ByteString, '__getitem__', '__len__') |
| 1960 | |
| 1961 | with self.assertWarns(DeprecationWarning): |
| 1962 | class X(ByteString): pass |
| 1963 | |
| 1964 | with self.assertWarns(DeprecationWarning): |
| 1965 | # No metaclass conflict |
| 1966 | class Z(ByteString, Awaitable): pass |
| 1967 | |
| 1968 | def test_ByteString_attribute_access(self): |
| 1969 | collections_abc = import_fresh_module( |
nothing calls this directly
no test coverage detected