mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	Fix copy&paste errors and reformulate the tests.
This commit is contained in:
		
							parent
							
								
									3bb516bae2
								
							
						
					
					
						commit
						b716f84880
					
				
					 1 changed files with 4 additions and 14 deletions
				
			
		| 
						 | 
					@ -4001,24 +4001,14 @@ def test_memoryview_hash(self):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # equality-hash invariant
 | 
					        # equality-hash invariant
 | 
				
			||||||
        x = ndarray(list(range(12)), shape=[12], format='B')
 | 
					        x = ndarray(list(range(12)), shape=[12], format='B')
 | 
				
			||||||
        a = memoryview(nd)
 | 
					        a = memoryview(x)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        y = ndarray(list(range(12)), shape=[12], format='b')
 | 
					        y = ndarray(list(range(12)), shape=[12], format='b')
 | 
				
			||||||
        b = memoryview(nd)
 | 
					        b = memoryview(y)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        z = ndarray(list(bytes(chr(x), 'latin-1') for x in range(12)),
 | 
					        self.assertEqual(a, b)
 | 
				
			||||||
                    shape=[12], format='c')
 | 
					 | 
				
			||||||
        c = memoryview(nd)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (a == b):
 | 
					 | 
				
			||||||
        self.assertEqual(hash(a), hash(b))
 | 
					        self.assertEqual(hash(a), hash(b))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (a == c):
 | 
					 | 
				
			||||||
            self.assertEqual(hash(a), hash(c))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (b == c):
 | 
					 | 
				
			||||||
            self.assertEqual(hash(b), hash(c))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # non-byte formats
 | 
					        # non-byte formats
 | 
				
			||||||
        nd = ndarray(list(range(12)), shape=[2,2,3], format='L')
 | 
					        nd = ndarray(list(range(12)), shape=[2,2,3], format='L')
 | 
				
			||||||
        m = memoryview(nd)
 | 
					        m = memoryview(nd)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue