aboutsummaryrefslogtreecommitdiff
path: root/src/argaze.test/AreaOfInterest/AOIFeatures.py
diff options
context:
space:
mode:
authorThéo de la Hogue2022-11-21 19:30:59 +0100
committerThéo de la Hogue2022-11-21 19:30:59 +0100
commit880b3938ca230e54c02bc7a87c7bd38b31b34c77 (patch)
tree9bb3134993e38c4cc71b92d5dc6b5e6d89806473 /src/argaze.test/AreaOfInterest/AOIFeatures.py
parentd36362bbb9d168cc612bfd163fa04d151ad362aa (diff)
downloadargaze-880b3938ca230e54c02bc7a87c7bd38b31b34c77.zip
argaze-880b3938ca230e54c02bc7a87c7bd38b31b34c77.tar.gz
argaze-880b3938ca230e54c02bc7a87c7bd38b31b34c77.tar.bz2
argaze-880b3938ca230e54c02bc7a87c7bd38b31b34c77.tar.xz
Moving copy and TimeStampSceneBuffer tests inside AOI2DScene and AOI3DScene
Diffstat (limited to 'src/argaze.test/AreaOfInterest/AOIFeatures.py')
-rw-r--r--src/argaze.test/AreaOfInterest/AOIFeatures.py52
1 files changed, 12 insertions, 40 deletions
diff --git a/src/argaze.test/AreaOfInterest/AOIFeatures.py b/src/argaze.test/AreaOfInterest/AOIFeatures.py
index 650411a..0a5e44c 100644
--- a/src/argaze.test/AreaOfInterest/AOIFeatures.py
+++ b/src/argaze.test/AreaOfInterest/AOIFeatures.py
@@ -126,6 +126,18 @@ class TestAOISceneClass(unittest.TestCase):
self.assertEqual(len(aoi_2d_scene.items()), 1)
self.assertEqual(list(aoi_2d_scene.keys()), ["A"])
+ def test___set_item__(self):
+ """Test AOIScene __set_item__ method."""
+
+ aoi_2d_scene = AOIFeatures.AOIScene(2,)
+
+ # Check AOI with same dimension can be added
+ aoi_2d_scene["A"] = AOIFeatures.AreaOfInterest([[0, 0], [0, 1], [1, 1], [1, 0]])
+
+ # Check that AOI with different dimension fails
+ with self.assertRaises(AssertionError):
+ aoi_2d_scene["B"] = AOIFeatures.AreaOfInterest([[0, 0, 0], [0, 1, 0], [1, 1, 0], [1, 0, 0]])
+
def test___repr__(self):
"""Test AOIScene string representation."""
@@ -159,46 +171,6 @@ class TestAOISceneClass(unittest.TestCase):
self.assertIsNone(numpy.testing.assert_array_equal(aoi_2d_scene.center, [1, 1]))
self.assertIsNone(numpy.testing.assert_array_equal(aoi_2d_scene.size, [2, 2]))
- def test_copy(self):
- """Test AOIScene copy method."""
-
- aoi_2D_A = AOIFeatures.AreaOfInterest([[0, 0], [0, 1], [1, 1], [1, 0]])
- aoi_2D_B = AOIFeatures.AreaOfInterest([[1, 1], [1, 2], [2, 2], [2, 1]])
- aoi_2d_scene = AOIFeatures.AOIScene(2, {"A": aoi_2D_A, "B": aoi_2D_B})
-
- # Check full copy
- aoi_2d_scene_copy = aoi_2d_scene.copy()
-
- self.assertEqual(aoi_2d_scene_copy.dimension, 2)
- self.assertEqual(len(aoi_2d_scene_copy.items()), 2)
- self.assertEqual(list(aoi_2d_scene_copy.keys()), ["A", "B"])
-
- # Check cpy with exclusion
- aoi_2d_scene_copy = aoi_2d_scene.copy(exclude=["B"])
-
- self.assertEqual(aoi_2d_scene_copy.dimension, 2)
- self.assertEqual(len(aoi_2d_scene_copy.items()), 1)
- self.assertEqual(list(aoi_2d_scene_copy.keys()), ["A"])
-
-class TestTimeStampedAOIScenesClass(unittest.TestCase):
- """Test TimeStampedAOIScenes class."""
-
- def test___setitem__(self):
- """Test TimeStampedAOIScenes creation."""
-
- aoi_2D_A = AOIFeatures.AreaOfInterest([[0, 0], [0, 1], [1, 1], [1, 0]])
- aoi_2D_B = AOIFeatures.AreaOfInterest([[1, 1], [1, 2], [2, 2], [2, 1]])
- aoi_2d_scene = AOIFeatures.AOIScene(2, {"A": aoi_2D_A, "B": aoi_2D_B})
-
- ts_aois_scenes = AOIFeatures.TimeStampedAOIScenes()
-
- ts_aois_scenes[0] = aoi_2d_scene
-
- # Check that only AOIScene can be added
- with self.assertRaises(AssertionError):
-
- ts_aois_scenes[1] = "This string is not an AOIScene"
-
if __name__ == '__main__':
unittest.main() \ No newline at end of file