def test_can_create_new_array_from_example(self): arr = ArrayWithUnits(np.zeros((100, 10)), [ContrivedDimension(10), ContrivedDimension2(10)]) arr2 = ArrayWithUnits.from_example(np.zeros((90, 5)), arr) self.assertSequenceEqual(arr.dimensions, arr2.dimensions) self.assertEqual((90, 5), arr2.shape)
def test_size_is_not_modified_on_example_dimensions(self): arr = ArrayWithUnits(np.zeros((100, 10)), [ContrivedDimension(10), ContrivedDimension2(10)]) arr2 = ArrayWithUnits.from_example(np.zeros((90, 5)), arr) self.assertEqual(100, arr.dimensions[0].size) self.assertEqual(10, arr.dimensions[1].size) self.assertEqual(90, arr2.dimensions[0].size) self.assertEqual(5, arr2.dimensions[1].size)