aboutsummaryrefslogtreecommitdiff
path: root/src/argaze.test
diff options
context:
space:
mode:
Diffstat (limited to 'src/argaze.test')
-rw-r--r--src/argaze.test/GazeFeatures.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/argaze.test/GazeFeatures.py b/src/argaze.test/GazeFeatures.py
index 5a3c2d9..dd0717c 100644
--- a/src/argaze.test/GazeFeatures.py
+++ b/src/argaze.test/GazeFeatures.py
@@ -117,6 +117,7 @@ class TestTimeStampedGazePositionsClass(unittest.TestCase):
ts_gaze_positions = GazeFeatures.TimeStampedGazePositions()
ts_gaze_positions[0] = GazeFeatures.GazePosition()
ts_gaze_positions[1] = GazeFeatures.UnvalidGazePosition()
+ ts_gaze_positions[2] = {"value": (0, 0), "accuracy": 0.}
# Check GazePosition is correctly stored and accessible as a GazePosition
self.assertIsInstance(ts_gaze_positions[0], GazeFeatures.GazePosition)
@@ -126,13 +127,22 @@ class TestTimeStampedGazePositionsClass(unittest.TestCase):
self.assertIsInstance(ts_gaze_positions[1], GazeFeatures.UnvalidGazePosition)
self.assertEqual(ts_gaze_positions[1].valid, False)
+ # Check dict with "value" and "accuracy" keys is correctly stored and accessible as a GazePosition
+ self.assertIsInstance(ts_gaze_positions[2], GazeFeatures.GazePosition)
+ self.assertEqual(ts_gaze_positions[2].valid, True)
+
# Check that bad data type insertion fails
with self.assertRaises(AssertionError):
- ts_gaze_positions[2] = "This string is not a gaze position value."
+ ts_gaze_positions[3] = "This string is not a gaze position value."
+
+ # Check that dict with bad keys insertion fails
+ with self.assertRaises(AssertionError):
+
+ ts_gaze_positions[4] = {"bad_key": (0, 0), "accuracy": 0.}
# Check final lenght
- self.assertEqual(len(ts_gaze_positions), 2)
+ self.assertEqual(len(ts_gaze_positions), 3)
def test___repr__(self):
"""Test inherited string representation."""