aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/argaze.test/AreaOfInterest/AOIFeatures.py11
-rw-r--r--src/argaze/AreaOfInterest/AOIFeatures.py5
2 files changed, 16 insertions, 0 deletions
diff --git a/src/argaze.test/AreaOfInterest/AOIFeatures.py b/src/argaze.test/AreaOfInterest/AOIFeatures.py
index 0a5e44c..c1158f6 100644
--- a/src/argaze.test/AreaOfInterest/AOIFeatures.py
+++ b/src/argaze.test/AreaOfInterest/AOIFeatures.py
@@ -66,6 +66,17 @@ class TestAreaOfInterestClass(unittest.TestCase):
self.assertEqual(repr(aoi_2D_float), f'[[0.0, 0.0], [0.0, {repr(math.pi)}], [{repr(math.pi)}, 0.0], [{repr(math.pi)}, {repr(math.pi)}]]')
+ def test___str__(self):
+ """Test AreaOfInterest string display."""
+
+ aoi_2D_int = AOIFeatures.AreaOfInterest([[0, 0], [0, 1], [1, 0], [1, 1]])
+
+ self.assertEqual(str(aoi_2D_int), "[[0, 0], [0, 1], [1, 0], [1, 1]]")
+
+ aoi_2D_float = AOIFeatures.AreaOfInterest([[0, 0], [0, math.pi], [math.pi, 0], [math.pi, math.pi]])
+
+ self.assertEqual(str(aoi_2D_float), f'[[0.0, 0.0], [0.0, {str(math.pi)}], [{str(math.pi)}, 0.0], [{str(math.pi)}, {str(math.pi)}]]')
+
def text_clockwise(self):
"""Test AreaOfInterest clockwise method."""
diff --git a/src/argaze/AreaOfInterest/AOIFeatures.py b/src/argaze/AreaOfInterest/AOIFeatures.py
index 33caa87..a3a878d 100644
--- a/src/argaze/AreaOfInterest/AOIFeatures.py
+++ b/src/argaze/AreaOfInterest/AOIFeatures.py
@@ -27,6 +27,11 @@ class AreaOfInterest(numpy.ndarray):
return repr(self.tolist())
+ def __str__(self):
+ """String display"""
+
+ return repr(self.tolist())
+
@property
def dimension(self) -> int:
"""Number of axis coding area points positions."""