Skip to content

Commit

Permalink
Update test_danger_detector.py
Browse files Browse the repository at this point in the history
  • Loading branch information
yihong1120 authored May 8, 2024
1 parent a296bbb commit 73fb89e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/test_danger_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand All @@ -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.")
Expand All @@ -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.")
Expand All @@ -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.")
Expand All @@ -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.")
Expand Down

0 comments on commit 73fb89e

Please sign in to comment.