def test_ts_image_path_assign_truncated(self): """Test TimeStreamImage path assignment with valid parameters""" img = TimeStreamImage() img.path = helpers.FILES["zeros_jpg"] self.assertEqual(img.path, helpers.FILES["zeros_jpg"]) self.assertEqual(img.datetime, helpers.ZEROS_DATETIME) np.testing.assert_array_equal(img.pixels, helpers.ZEROS_PIXELS)
def test_ts_image_path_assign_parent(self): """Test TimeStreamImage path assignment with valid parameters & parent""" ts = TimeStream() ts.load(helpers.FILES["timestream"]) img = TimeStreamImage() img.parent_timestream = ts img.path = helpers.TS_FILES_JPG[0] self.assertEqual(img.path, helpers.TS_FILES_JPG[0]) self.assertEqual(img.datetime, helpers.TS_DATES_PARSED[0])
def test_ts_image_clone(self): """Test TimeStreamImage.clone()""" img = TimeStreamImage() img.path = helpers.FILES["zeros_jpg"] cpy = img.clone() self.assertIsNot(cpy, img) self.assertIsNot(cpy.datetime, img.datetime) self.assertIsNot(cpy.data, img.data) self.assertEqual(cpy.data, img.data) self.assertIs(cpy._pixels, None) self.assertIs(cpy._timestream, None) self.assertIs(cpy._path, None)
def test_ts_image_clone_all(self): """Test TimeStreamImage.clone(), cloning all members""" ts = TimeStream() img = TimeStreamImage() img.parent_timestream = ts img.path = helpers.FILES["zeros_jpg"] cpy = img.clone(True, True, True) self.assertIsNot(cpy, img) self.assertIsNot(cpy.datetime, img.datetime) self.assertEqual(cpy.datetime, img.datetime) self.assertIsNot(cpy.data, img.data) self.assertEqual(cpy.data, img.data) self.assertIsNot(cpy.pixels, img.pixels) np.testing.assert_array_equal(cpy.pixels, img.pixels) # TS should be copied as a refernce, hence *Is*, not Is Not self.assertIs(cpy.parent_timestream, img.parent_timestream) self.assertEqual(cpy.parent_timestream, img.parent_timestream) # Strings are cached, so no assertIsNot for path self.assertEqual(cpy.path, img.path)
def test_ts_image_path_assign(self): """Test TimeStreamImage. path assignment with valid parameters""" img = TimeStreamImage() img.path = helpers.TS_FILES_JPG[0] self.assertEqual(img.path, helpers.TS_FILES_JPG[0])