MCPcopy Create free account
hub / github.com/ahalev/python-microgrid / assertEqual

Method assertEqual

tests/helpers/test_case.py:8–23  ·  view source on GitHub ↗
(self, first, second, msg=None)

Source from the content-addressed store, hash-verified

6
7class TestCase(unittest.TestCase):
8 def assertEqual(self, first, second, msg=None) -> None:
9 try:
10 super().assertEqual(first, second, msg=msg)
11 except (ValueError, AssertionError):
12 # array-like or pandas obj
13 # convert pandas obj
14 if isinstance(first, (pd.DataFrame, pd.Series)):
15 first, second = first.values, second.values
16
17 try:
18 np.testing.assert_equal(first, second, err_msg=msg if msg else '')
19 except AssertionError as e:
20 try:
21 np.testing.assert_allclose(first, second, rtol=1e-7, atol=1e-10, err_msg=msg if msg else '')
22 except TypeError:
23 raise e
24
25 def assertNotEqual(self, first, second, msg=None) -> None:
26 try:

Callers 15

assertNotEqualMethod · 0.95
test_set_horizonMethod · 0.80
test_forecast_allMethod · 0.80
test_forecast_pvMethod · 0.80
test_forecast_loadMethod · 0.80
test_runMethod · 0.80
test_train_test_splitMethod · 0.80
test_resetMethod · 0.80
test_get_random_fileMethod · 0.80
test_get_gensetMethod · 0.80
test_get_batteryMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected