Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Coline PILOQUET <coline.piloquet@rte-france.com>
  • Loading branch information
colinepiloquet committed Jul 26, 2024
1 parent f64b069 commit df61129
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions tests/test_java_perunit.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,17 @@ def test_dangling_lines_per_unit():

expected = pd.DataFrame(index=pd.Series(name='id', data=['DL']),
columns=['name', 'r', 'x', 'g', 'b', 'p0', 'q0', 'p', 'q', 'i', 'voltage_level_id',
'bus_id', 'connected', 'pairing_key', 'ucte_xnode_code', 'tie_line_id'],
'bus_id', 'connected', 'pairing_key', 'tie_line_id'],
data=[['', 0.1, 0.01, 0.01, 0.001, 0.5, 0.3, 0.5482, 0.3029, 0.6263, 'VL', 'VL_0',
True, '', '', '']])
True, '', '']])
dangling_lines = n.get_dangling_lines()
pd.testing.assert_frame_equal(expected, dangling_lines, check_dtype=False, atol=10 ** -4)
n.update_dangling_lines(pd.DataFrame(index=['DL'], columns=['p0', 'q0'], data=[[0.75, 0.25]]))
expected = pd.DataFrame(index=pd.Series(name='id', data=['DL']),
columns=['name', 'r', 'x', 'g', 'b', 'p0', 'q0', 'p', 'q', 'i', 'voltage_level_id',
'bus_id', 'connected', 'pairing_key', 'ucte_xnode_code', 'tie_line_id'],
'bus_id', 'connected', 'pairing_key', 'tie_line_id'],
data=[['', 0.1, 0.01, 0.01, 0.001, 0.75, 0.25, 0.5482, 0.3029, 0.6263, 'VL', 'VL_0',
True, '', '', '']])
True, '', '']])
dangling_lines = n.get_dangling_lines()
pd.testing.assert_frame_equal(expected, dangling_lines, check_dtype=False, atol=10 ** -4)

Expand Down
8 changes: 4 additions & 4 deletions tests/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -992,18 +992,18 @@ def test_dangling_lines():
expected = pd.DataFrame(index=pd.Series(name='id', data=['DL']),
columns=['name', 'r', 'x', 'g', 'b', 'p0', 'q0', 'p', 'q', 'i', 'voltage_level_id',
'bus_id',
'connected', 'pairing_key', 'ucte_xnode_code', 'tie_line_id'],
'connected', 'pairing_key', 'tie_line_id'],
data=[['', 10.0, 1.0, 0.0001, 0.00001, 50.0, 30.0, nan, nan, nan, 'VL', 'VL_0', True,
'', '', '']])
'', '']])
pd.testing.assert_frame_equal(expected, n.get_dangling_lines(), check_dtype=False)
n.update_dangling_lines(
pd.DataFrame(index=['DL'], columns=['r', 'x', 'g', 'b', 'p0', 'q0', 'connected'],
data=[[11.0, 1.1, 0.0002, 0.00002, 40.0, 40.0, False]]))
updated = pd.DataFrame(index=pd.Series(name='id', data=['DL']),
columns=['name', 'r', 'x', 'g', 'b', 'p0', 'q0', 'p', 'q', 'i', 'voltage_level_id',
'bus_id', 'connected', 'pairing_key', 'ucte_xnode_code', 'tie_line_id'],
'bus_id', 'connected', 'pairing_key', 'tie_line_id'],
data=[['', 11.0, 1.1, 0.0002, 0.00002, 40.0, 40.0, nan, nan, nan, 'VL', '', False,
'', '', '']])
'', '']])
pd.testing.assert_frame_equal(updated, n.get_dangling_lines(), check_dtype=False)
n = util.create_dangling_lines_network()
dangling_lines = n.get_dangling_lines(attributes=['bus_breaker_bus_id', 'node'])
Expand Down
4 changes: 2 additions & 2 deletions tests/test_network_elements_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ def test_deprecated_ucte_xnode_code_kwargs():
ucte_xnode_code=['XNODE1', 'XNODE'])
assert 'DL_TEST' in network.get_dangling_lines().index
assert 'DL_TEST2' in network.get_dangling_lines().index
assert 'ucte_xnode_code' in network.get_dangling_lines().columns
assert 'ucte_xnode_code' in network.get_dangling_lines(all_attributes=True).columns


def test_deprecated_ucte_xnode_code_dataframe():
Expand All @@ -939,7 +939,7 @@ def test_deprecated_ucte_xnode_code_dataframe():
index='id'))
assert 'DL_TEST' in network.get_dangling_lines().index
assert 'DL_TEST2' in network.get_dangling_lines().index
assert 'ucte_xnode_code' in network.get_dangling_lines().columns
assert 'ucte_xnode_code' in network.get_dangling_lines(all_attributes=True).columns


def test_3_windings_transformers_creation():
Expand Down
8 changes: 4 additions & 4 deletions tests/test_per_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,17 @@ def test_dangling_lines_per_unit():

expected = pd.DataFrame(index=pd.Series(name='id', data=['DL']),
columns=['name', 'r', 'x', 'g', 'b', 'p0', 'q0', 'p', 'q', 'i', 'voltage_level_id',
'bus_id', 'connected', 'pairing_key', 'ucte_xnode_code', 'tie_line_id'],
'bus_id', 'connected', 'pairing_key', 'tie_line_id'],
data=[['', 0.1, 0.01, 0.01, 0.001, 0.5, 0.3, 0.5482, 0.3029, 0.6263, 'VL', 'VL_0',
True, '', '', '']])
True, '', '']])
dangling_lines = n.get_dangling_lines()
pd.testing.assert_frame_equal(expected, dangling_lines, check_dtype=False, atol=10 ** -4)
n.update_dangling_lines(pd.DataFrame(index=['DL'], columns=['p0', 'q0'], data=[[0.75, 0.25]]))
expected = pd.DataFrame(index=pd.Series(name='id', data=['DL']),
columns=['name', 'r', 'x', 'g', 'b', 'p0', 'q0', 'p', 'q', 'i', 'voltage_level_id',
'bus_id', 'connected', 'pairing_key', 'ucte_xnode_code', 'tie_line_id'],
'bus_id', 'connected', 'pairing_key', 'tie_line_id'],
data=[['', 0.1, 0.01, 0.01, 0.001, 0.75, 0.25, 0.5482, 0.3029, 0.6263, 'VL', 'VL_0',
True, '', '', '']])
True, '', '']])
dangling_lines = n.get_dangling_lines()
pd.testing.assert_frame_equal(expected, dangling_lines, check_dtype=False, atol=10 ** -4)

Expand Down

0 comments on commit df61129

Please sign in to comment.