def test_copy(self): shape0 = Shape((DimNames.BATCH, 16), (DimNames.CHANNEL, 3), (DimNames.HEIGHT, 48), (DimNames.WIDTH, 32), (DimNames.UNITS, 10), (DimNames.TIME, 13)) shape1 = shape0.__copy__() self.assertEqual(shape0, shape1) self.assertEqual(shape1, shape0) self.assertIsNot(shape0, shape1)
def test_hash(self): shape0 = Shape((DimNames.BATCH, 16), (DimNames.CHANNEL, 3), (DimNames.HEIGHT, 48), (DimNames.WIDTH, 32), (DimNames.UNITS, 10), (DimNames.TIME, 13)) hash0 = shape0.__hash__() shape1 = shape0.__copy__() hash1 = shape1.__hash__() self.assertIsInstance(hash0, int) self.assertIsInstance(hash1, int) self.assertEqual(hash0, hash1) self.assertEqual(hash1, hash0)