mirror of
				https://github.com/python/cpython.git
				synced 2025-11-01 06:01:29 +00:00 
			
		
		
		
	#16910: merge with 3.3.
This commit is contained in:
		
						commit
						5b1acc0dff
					
				
					 5 changed files with 19 additions and 25 deletions
				
			
		|  | @ -38,7 +38,7 @@ def __index__(self): | |||
|         return self.value | ||||
| 
 | ||||
| 
 | ||||
| class BaseBytesTest(unittest.TestCase): | ||||
| class BaseBytesTest: | ||||
| 
 | ||||
|     def test_basics(self): | ||||
|         b = self.type2test() | ||||
|  | @ -696,7 +696,7 @@ def test_find_etc_raise_correct_error_messages(self): | |||
|                                 x, None, None, None) | ||||
| 
 | ||||
| 
 | ||||
| class BytesTest(BaseBytesTest): | ||||
| class BytesTest(BaseBytesTest, unittest.TestCase): | ||||
|     type2test = bytes | ||||
| 
 | ||||
|     def test_buffer_is_readonly(self): | ||||
|  | @ -744,7 +744,7 @@ def test_from_format(self): | |||
|                          b's:cstr') | ||||
| 
 | ||||
| 
 | ||||
| class ByteArrayTest(BaseBytesTest): | ||||
| class ByteArrayTest(BaseBytesTest, unittest.TestCase): | ||||
|     type2test = bytearray | ||||
| 
 | ||||
|     def test_nohash(self): | ||||
|  | @ -1312,16 +1312,16 @@ def test_upper(self): | |||
|     def test_lower(self): | ||||
|         pass | ||||
| 
 | ||||
| class ByteArrayAsStringTest(FixedStringTest): | ||||
| class ByteArrayAsStringTest(FixedStringTest, unittest.TestCase): | ||||
|     type2test = bytearray | ||||
|     contains_bytes = True | ||||
| 
 | ||||
| class BytesAsStringTest(FixedStringTest): | ||||
| class BytesAsStringTest(FixedStringTest, unittest.TestCase): | ||||
|     type2test = bytes | ||||
|     contains_bytes = True | ||||
| 
 | ||||
| 
 | ||||
| class SubclassTest(unittest.TestCase): | ||||
| class SubclassTest: | ||||
| 
 | ||||
|     def test_basic(self): | ||||
|         self.assertTrue(issubclass(self.subclass2test, self.type2test)) | ||||
|  | @ -1393,7 +1393,7 @@ class ByteArraySubclass(bytearray): | |||
| class BytesSubclass(bytes): | ||||
|     pass | ||||
| 
 | ||||
| class ByteArraySubclassTest(SubclassTest): | ||||
| class ByteArraySubclassTest(SubclassTest, unittest.TestCase): | ||||
|     type2test = bytearray | ||||
|     subclass2test = ByteArraySubclass | ||||
| 
 | ||||
|  | @ -1408,16 +1408,10 @@ def __init__(me, newarg=1, *args, **kwargs): | |||
|         self.assertEqual(x, b"abcd") | ||||
| 
 | ||||
| 
 | ||||
| class BytesSubclassTest(SubclassTest): | ||||
| class BytesSubclassTest(SubclassTest, unittest.TestCase): | ||||
|     type2test = bytes | ||||
|     subclass2test = BytesSubclass | ||||
| 
 | ||||
| 
 | ||||
| def test_main(): | ||||
|     test.support.run_unittest( | ||||
|         BytesTest, AssortedBytesTest, BytesAsStringTest, | ||||
|         ByteArrayTest, ByteArrayAsStringTest, BytesSubclassTest, | ||||
|         ByteArraySubclassTest, BytearrayPEP3137Test) | ||||
| 
 | ||||
| if __name__ == "__main__": | ||||
|     test_main() | ||||
|     unittest.main() | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ezio Melotti
						Ezio Melotti