diff options
Diffstat (limited to 'src/argaze.test/AreaOfInterest/AOI3DScene.py')
-rw-r--r-- | src/argaze.test/AreaOfInterest/AOI3DScene.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/argaze.test/AreaOfInterest/AOI3DScene.py b/src/argaze.test/AreaOfInterest/AOI3DScene.py index 5a575bb..e74e246 100644 --- a/src/argaze.test/AreaOfInterest/AOI3DScene.py +++ b/src/argaze.test/AreaOfInterest/AOI3DScene.py @@ -71,6 +71,46 @@ class TestAOI3DSceneClass(unittest.TestCase): self.assertIsNone(numpy.testing.assert_array_equal(aoi_3d_scene['B'], [[2.0, 1.0, 0.0], [2.0, 2.0, 0.0], [3.0, 2.0, 0.0], [3.0, 1.0, 0.0]])) + def test_copy(self): + """Test AOI2DScene copy method.""" + + aoi_3D_A = AOIFeatures.AreaOfInterest([[0, 0, 0], [0, 1, 0], [1, 1, 0], [1, 0, 0]]) + aoi_3D_B = AOIFeatures.AreaOfInterest([[1, 1, 0], [1, 2, 0], [2, 2, 0], [2, 1, 0]]) + aoi_3d_scene = AOI3DScene.AOI3DScene({"A": aoi_3D_A, "B": aoi_3D_B}) + + # Check full copy + aoi_3d_scene_copy = aoi_3d_scene.copy() + + self.assertEqual(aoi_3d_scene_copy.dimension, 3) + self.assertEqual(len(aoi_3d_scene_copy.items()), 2) + self.assertEqual(list(aoi_3d_scene_copy.keys()), ["A", "B"]) + + # Check cpy with exclusion + aoi_3d_scene_copy = aoi_3d_scene.copy(exclude=["B"]) + + self.assertEqual(aoi_3d_scene_copy.dimension, 3) + self.assertEqual(len(aoi_3d_scene_copy.items()), 1) + self.assertEqual(list(aoi_3d_scene_copy.keys()), ["A"]) + +class TestTimeStampedAOIScenesClass(unittest.TestCase): + """Test TimeStampedAOIScenes class.""" + + def test___setitem__(self): + """Test TimeStampedAOIScenes creation.""" + + aoi_3D_A = AOIFeatures.AreaOfInterest([[0, 0, 0], [0, 1, 0], [1, 1, 0], [1, 0, 0]]) + aoi_3D_B = AOIFeatures.AreaOfInterest([[1, 1, 0], [1, 2, 0], [2, 2, 0], [2, 1, 0]]) + aoi_3d_scene = AOI3DScene.AOI3DScene({"A": aoi_3D_A, "B": aoi_3D_B}) + + ts_aois_scenes = AOIFeatures.TimeStampedAOIScenes() + + ts_aois_scenes[0] = aoi_3d_scene + + # Check that only AOIScene can be added + with self.assertRaises(AssertionError): + + ts_aois_scenes[1] = "This string is not an AOI3DScene" + if __name__ == '__main__': unittest.main()
\ No newline at end of file |