aboutsummaryrefslogtreecommitdiff
path: root/src/argaze.test
diff options
context:
space:
mode:
Diffstat (limited to 'src/argaze.test')
-rw-r--r--src/argaze.test/AreaOfInterest/AOIFeatures.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/argaze.test/AreaOfInterest/AOIFeatures.py b/src/argaze.test/AreaOfInterest/AOIFeatures.py
index c5e4ff4..f894eb8 100644
--- a/src/argaze.test/AreaOfInterest/AOIFeatures.py
+++ b/src/argaze.test/AreaOfInterest/AOIFeatures.py
@@ -13,14 +13,15 @@ class TestAreaOfInterestClass(unittest.TestCase):
def test_new(self):
"""Test AreaOfInterest creation."""
- # Check that 0D AreaOfInterest creation fails
- with self.assertRaises(TypeError):
+ # Check that 0D AreaOfInterest creation is considered as empty
+ aoi_0D = AOIFeatures.AreaOfInterest()
- aoi_0D = AOIFeatures.AreaOfInterest()
+ self.assertTrue(aoi_0D.empty)
# Check 1 point 1D AreaOfInterest creation
aoi_1D = AOIFeatures.AreaOfInterest([[0]])
+ self.assertFalse(aoi_1D.empty)
self.assertEqual(aoi_1D.dimension, 1)
self.assertEqual(aoi_1D.size, 1)
self.assertEqual(aoi_1D.center, [0])
@@ -31,6 +32,7 @@ class TestAreaOfInterestClass(unittest.TestCase):
# Check 2 points 1D AreaOfInterest creation
aoi_1D = AOIFeatures.AreaOfInterest([[0], [1]])
+ self.assertFalse(aoi_1D.empty)
self.assertEqual(aoi_1D.dimension, 1)
self.assertEqual(aoi_1D.size, 2)
self.assertEqual(aoi_1D.center, [0.5])
@@ -41,6 +43,7 @@ class TestAreaOfInterestClass(unittest.TestCase):
# Check 4 points 2D AreaOfInterest creation
aoi_2D = AOIFeatures.AreaOfInterest([[0, 0], [0, 1], [1, 0], [1, 1]])
+ self.assertFalse(aoi_2D.empty)
self.assertEqual(aoi_2D.dimension, 2)
self.assertEqual(aoi_2D.size, 4)
self.assertIsNone(numpy.testing.assert_array_equal(aoi_2D.center, [0.5, 0.5]))
@@ -49,6 +52,7 @@ class TestAreaOfInterestClass(unittest.TestCase):
# Check 8 points 3D AreaOfInterest creation
aoi_3D = AOIFeatures.AreaOfInterest([[0, 0, 0], [0, 1, 0], [1, 0, 0], [1, 1, 0], [0, 0, 1], [0, 1, 1], [1, 0, 1], [1, 1, 1]])
+ self.assertFalse(aoi_3D.empty)
self.assertEqual(aoi_3D.dimension, 3)
self.assertEqual(aoi_3D.size, 8)
@@ -82,8 +86,8 @@ class TestAreaOfInterestClass(unittest.TestCase):
aoi_2D_clockwise = AOIFeatures.AreaOfInterest([[0, 0], [0, 1], [1, 0], [1, 1]]).clockwise()
- assertEqual(type(aoi_2D_clockwise), AOIFeatures.AreaOfInterest)
- self.assertIsNone(numpy.testing.assert_array_equal(aoi_2D_clockwise, [0, 0], [0, 1], [1, 1], [1, 0]))
+ self.assertEqual(type(aoi_2D_clockwise), AOIFeatures.AreaOfInterest)
+ self.assertIsNone(numpy.testing.assert_array_equal(aoi_2D_clockwise, [[0, 0], [1, 0], [1, 1], [0, 1]]))
def test_contains_point(self):
"""Test AreaOfInterest contains_point method."""