From 73fb89e14d24c84dfa50516be411e4a9778bb87a Mon Sep 17 00:00:00 2001 From: YiHungWONG <40423264+yihong1120@users.noreply.github.com> Date: Wed, 8 May 2024 16:09:31 +0800 Subject: [PATCH] Update test_danger_detector.py --- tests/test_danger_detector.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/test_danger_detector.py b/tests/test_danger_detector.py index 836fafa..d990c49 100644 --- a/tests/test_danger_detector.py +++ b/tests/test_danger_detector.py @@ -17,7 +17,7 @@ def test_no_violations(self): Test that no warnings are generated when there are no violations. """ datas = [ - [100, 200, 300, 400, 0.95, 5.0] # Person with no violations + [100, 200, 300, 400, 0.95, 5] # Person with no violations ] warnings = self.detector.detect_danger(datas) self.assertEqual(len(warnings), 0, "Expected no warnings when there are no violations.") @@ -27,8 +27,8 @@ def test_hardhat_violations(self): Test detection of workers not wearing hardhats. """ datas = [ - [100, 200, 300, 400, 0.95, 5.0], # Person - [100, 200, 300, 400, 0.90, 2.0] # No hardhat + [100, 200, 300, 400, 0.95, 5], # Person + [100, 200, 300, 400, 0.90, 2] # No hardhat ] warnings = self.detector.detect_danger(datas) self.assertIn("Warning: Someone is not wearing a hardhat!", warnings, "Expected a hardhat violation warning.") @@ -38,8 +38,8 @@ def test_safety_vest_violations(self): Test detection of workers not wearing safety vests. """ datas = [ - [100, 200, 300, 400, 0.95, 5.0], # Person - [100, 200, 300, 400, 0.90, 4.0] # No safety vest + [100, 200, 300, 400, 0.95, 5], # Person + [100, 200, 300, 400, 0.90, 4] # No safety vest ] warnings = self.detector.detect_danger(datas) self.assertIn("Warning: Someone is not wearing a safety vest!", warnings, "Expected a safety vest violation warning.") @@ -49,8 +49,8 @@ def test_proximity_to_machinery(self): Test detection of workers dangerously close to machinery. """ datas = [ - [100, 200, 300, 400, 0.95, 5.0], # Person - [290, 350, 410, 450, 0.88, 8.0] # Machinery + [100, 200, 300, 400, 0.95, 5], # Person + [290, 350, 410, 450, 0.88, 8] # Machinery ] warnings = self.detector.detect_danger(datas) self.assertIn("Warning: Someone is dangerously close to machinery!", warnings, "Expected a proximity warning for machinery.") @@ -60,8 +60,8 @@ def test_proximity_to_vehicles(self): Test detection of workers dangerously close to vehicles. """ datas = [ - [100, 200, 300, 400, 0.95, 5.0], # Person - [290, 350, 410, 450, 0.88, 9.0] # Vehicle + [100, 200, 300, 400, 0.95, 5], # Person + [290, 350, 410, 450, 0.88, 9] # Vehicle ] warnings = self.detector.detect_danger(datas) self.assertIn("Warning: Someone is dangerously close to a vehicle!", warnings, "Expected a proximity warning for vehicles.")