-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_carbon_intensity.py
More file actions
29 lines (22 loc) · 1.07 KB
/
test_carbon_intensity.py
File metadata and controls
29 lines (22 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import pytest
from datetime import datetime
import codegreen_core.tools.carbon_intensity as ci
class TestCarbonIntensity:
def test_if_incorrect_data_provided1(self):
with pytest.raises(ValueError):
ci.compute_ci("DE", datetime(2024, 1, 2), "2024,1,1")
def test_if_incorrect_data_provided2(self):
with pytest.raises(ValueError):
ci.compute_ci("DE", 123, datetime(2024, 1, 2))
def test_if_incorrect_data_provided3(self):
with pytest.raises(ValueError):
ci.compute_ci(123, datetime(2024, 1, 2), datetime(2024, 1, 3))
def test_if_incorrect_data_provided4(self):
with pytest.raises(ValueError):
ci.compute_ci_from_energy("DE", datetime(2024, 1, 2), "2024,1,1")
def test_if_incorrect_data_provided5(self):
with pytest.raises(ValueError):
ci.compute_ci_from_energy("DE", 123, datetime(2024, 1, 2))
def test_if_incorrect_data_provided6(self):
with pytest.raises(ValueError):
ci.compute_ci_from_energy(123, datetime(2024, 1, 2), datetime(2024, 1, 3))