From a125dab309928900b89af7983c2a744b34260592 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Wed, 10 May 2023 12:03:22 +0200 Subject: Testing that error is raised when creating a bad visual scan path. --- src/argaze.test/GazeFeatures.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/argaze.test') 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 -- cgit v1.1