| Total Complexity | 5 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import pytest |
||
| 2 | |||
| 3 | from oemof.solph import _results |
||
| 4 | |||
| 5 | from . import optimization_model |
||
| 6 | |||
| 7 | |||
| 8 | class TestResultsClass: |
||
| 9 | @classmethod |
||
| 10 | def setup_class(cls): |
||
| 11 | cls.results = _results.Results(optimization_model) |
||
| 12 | |||
| 13 | def test_objective(self): |
||
| 14 | assert int(self.results.objective) == 8495 |
||
| 15 | |||
| 16 | def test_to_set_objective(self): |
||
| 17 | with pytest.raises(AttributeError): |
||
| 18 | self.results.objective = 5 |
||
| 19 | |||
| 20 | def test_time_index(self): |
||
| 21 | assert len(self.results.timeindex) == 25 |
||
| 22 | assert ( |
||
| 23 | self.results.timeindex[3].strftime("%m/%d/%Y, %H") |
||
| 24 | == "01/01/2012, 03" |
||
| 25 | ) |
||
| 26 |