Skip to content

Commit ee9bd7d

Browse files
committed
tests: Add new test to check if object creation works as expected.
1 parent 63c3617 commit ee9bd7d

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/test_obj.py

+27
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
Vsource, Transformer, LineCode, Load, Line, Capacitor,
2121
Connection as Conn, RegControl, LengthUnit as Units,
2222
LoadModel, Edit, AltDSS, altdss, LineGeometry, LineSpacing,
23+
DSSException
2324
)
2425

2526
def create_ref_ckt13(ref):
@@ -800,6 +801,32 @@ def test_obj_setter():
800801
assert all(l.Daily == default_shape for l in altdss.Load)
801802

802803

804+
def test_new():
805+
altdss.Clear()
806+
altdss('new circuit.test')
807+
altdss('new transformer.A')
808+
with pytest.raises(DSSException):
809+
altdss('new transformer.A')
810+
811+
assert 'a' in altdss.Transformer.Name
812+
813+
with pytest.raises(DSSException):
814+
altdss.Transformer.new('A')
815+
816+
with pytest.raises(DSSException):
817+
altdss.Transformer.batch_new(['A'])
818+
819+
altdss.Transformer.new('B')
820+
with pytest.raises(DSSException):
821+
altdss('new transformer.B')
822+
823+
with pytest.raises(DSSException):
824+
altdss.Transformer.new('B')
825+
826+
with pytest.raises(DSSException):
827+
altdss.Transformer.batch_new(['B'])
828+
829+
803830
if __name__ == '__main__':
804831
# Adjust for manual running a test-case
805832
test_register_values()

0 commit comments

Comments
 (0)