aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2023-05-10 12:03:22 +0200
committerThéo de la Hogue2023-05-10 12:03:22 +0200
commita125dab309928900b89af7983c2a744b34260592 (patch)
treec6de7149930d0fe438c027112efbad8834331178
parent44bf76527e59dafc46e2075605454bf23523a666 (diff)
downloadargaze-a125dab309928900b89af7983c2a744b34260592.zip
argaze-a125dab309928900b89af7983c2a744b34260592.tar.gz
argaze-a125dab309928900b89af7983c2a744b34260592.tar.bz2
argaze-a125dab309928900b89af7983c2a744b34260592.tar.xz
Testing that error is raised when creating a bad visual scan path.
-rw-r--r--src/argaze.test/GazeFeatures.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/argaze.test/GazeFeatures.py b/src/argaze.test/GazeFeatures.py
index dd3c49b..aebbcfc 100644
--- a/src/argaze.test/GazeFeatures.py
+++ b/src/argaze.test/GazeFeatures.py
@@ -299,6 +299,30 @@ class TestVisualScanPathClass(unittest.TestCase):
self.assertEqual(len(new_step.movements), 2)
self.assertEqual(new_step.aoi, 'A')
+ def test_append_error(self):
+ """Test VisualScanPath append error."""
+
+ visual_scan_path = GazeFeatures.VisualScanPath()
+
+ # Append fixation on A aoi
+ fixation = GazeFeatures.Fixation(random_gaze_positions(10))
+ ts, _ = fixation.positions.first
+
+ new_step = visual_scan_path.append_fixation(ts, fixation, 'A')
+
+ # Check that no visual scan step have been created yet
+ self.assertEqual(len(visual_scan_path), 0)
+ self.assertEqual(new_step, None)
+
+ # Append fixation on B aoi
+ fixation = GazeFeatures.Fixation(random_gaze_positions(10))
+ ts, _ = fixation.positions.first
+
+ # Check that visual scan step creation fail
+ with self.assertRaises(GazeFeatures.VisualScanStepError):
+
+ new_step = visual_scan_path.append_fixation(ts, fixation, 'B')
+
if __name__ == '__main__':
unittest.main() \ No newline at end of file