Skip to content

Commit dcaa3c7

Browse files
committed
tests: add test for Lines.Parent, with and without the compatibility flag.
1 parent fc6f6ce commit dcaa3c7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/test_general.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,23 @@ def test_loadshape_save():
803803
npt.assert_allclose(pmult, pmult_sng)
804804

805805

806+
def test_line_parent_compat():
807+
from dss import DSSCompatFlags
808+
DSS.Text.Command = f'redirect "{BASE_DIR}/Version8/Distrib/IEEETestCases/13Bus/IEEE13Nodeckt.dss"'
809+
DSS.Text.Command = 'new energymeter.m1 element=transformer.sub'
810+
DSS.Text.Command = 'solve mode=snap'
811+
DSS.CompatFlags = DSSCompatFlags.ActiveLine
812+
Lines = DSS.ActiveCircuit.Lines
813+
res_compat = Lines.First, Lines.Next, Lines.Name, Lines.Next, Lines.Name, Lines.Parent, Lines.Name, Lines.Parent, Lines.Name
814+
DSS.CompatFlags = 0
815+
res_no_compat = Lines.First, Lines.Next, Lines.Name, Lines.Next, Lines.Name, Lines.Parent, Lines.Name, Lines.Parent, Lines.Name
816+
817+
assert res_no_compat == (1, 2, '632670', 3, '670671', 2, '632670', 1, '650632')
818+
819+
# The indices returned in compat mode are "wrong", to match the official DSS implementation
820+
assert res_compat[3:2:] == res_no_compat[3:2:]
821+
822+
806823
if __name__ == '__main__':
807824
# for _ in range(250):
808825
# test_pm_threads()

0 commit comments

Comments
 (0)