diff options
Diffstat (limited to 'src/argaze.test/AreaOfInterest/AOIFeatures.py')
-rw-r--r-- | src/argaze.test/AreaOfInterest/AOIFeatures.py | 52 |
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 |