Skip to content

Commit

Permalink
Fix parser test
Browse files Browse the repository at this point in the history
  • Loading branch information
PedramBakh committed Sep 13, 2024
1 parent 2e4c761 commit b509714
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,22 +920,22 @@ def test_print_aggregate_empty_equivalents(
log_dir = "/logs"
print_aggregate(log_dir)
mock_print.assert_called_once_with(
"The training of models in this work is estimated to use 100.000 kWh of electricity contributing to 50.000 kg of CO2eq. Measured by carbontracker (https://github.com/lfwa/carbontracker)."
"The training of models in this work is estimated to use 100.0000000000000000 kWh of electricity contributing to 50.0000000000000000 kg of CO2eq. Measured by carbontracker (https://github.com/lfwa/carbontracker)."
)

@mock.patch("builtins.print")
@mock.patch(
"carbontracker.parser.aggregate_consumption",
return_value=(100.0, 50000.0, {"km travelled": 200.0}),
return_value=(100.0, 5000.0, {"km travelled": 200.0}),
)
def test_print_aggregate_non_empty_equivalents(
self, mock_aggregate_consumption, mock_print
):
log_dir = "/logs"
print_aggregate(log_dir)
mock_print.assert_called_once_with(
"The training of models in this work is estimated to use 100.000 kWh of electricity contributing to 50.000 kg of CO2eq. "
"This is equivalent to 200.000 km travelled. "
"The training of models in this work is estimated to use 100.0000000000000000 kWh of electricity contributing to 5.0000000000000000 kg of CO2eq. "
"This is equivalent to 200.0000000000000000 km travelled. "
"Measured by carbontracker (https://github.com/lfwa/carbontracker)."
)

Expand Down

0 comments on commit b509714

Please sign in to comment.