diff options
-rw-r--r-- | src/argaze.test/GazeFeatures.py | 24 |
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 |