Skip to content

Commit

Permalink
Formatted with pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yihong1120 committed Jul 17, 2024
1 parent 7a44a8f commit 3704446
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 9 additions & 3 deletions tests/live_stream_tracker_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ def test_generate_detections(
mock_results[0].boxes = mock_boxes
mock_yolo_instance.track.return_value = mock_results

mock_now = datetime.datetime(2023, 1, 1, 0, 0, 0, tzinfo=datetime.timezone.utc)
mock_now = datetime.datetime(
2023, 1, 1, 0, 0, 0, tzinfo=datetime.timezone.utc,
)
mock_datetime.datetime.now.side_effect = [mock_now, mock_now]

frame_generator = self.detector.generate_detections()
Expand Down Expand Up @@ -98,10 +100,14 @@ def test_run_detection(self, mock_generate_detections):

with patch('builtins.print') as mock_print:
self.detector.run_detection()
expected_datetime = datetime.datetime.fromtimestamp(1234567890.0, tz=datetime.timezone.utc).strftime('%Y-%m-%d %H:%M:%S')
expected_datetime = datetime.datetime.fromtimestamp(
1234567890.0, tz=datetime.timezone.utc,
).strftime('%Y-%m-%d %H:%M:%S')
self.assertTrue(
any(
'Timestamp:' in str(call) and expected_datetime in str(call)
'Timestamp:' in str(
call,
) and expected_datetime in str(call)
for call in mock_print.call_args_list
),
)
Expand Down
4 changes: 3 additions & 1 deletion tests/monitor_logger_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ def test_logger_output(
# Test logging output
with self.assertLogs(logger, level='INFO') as log:
logger.info('Test log message')
expected_message = 'INFO:SiteSafetyMonitor_test.log:Test log message'.upper()
expected_message = (
'INFO:SiteSafetyMonitor_test.log:Test log message'.upper()
)
log_messages = [msg.upper() for msg in log.output]
self.assertIn(expected_message, log_messages)

Expand Down

0 comments on commit 3704446

Please sign in to comment.