@@ -47,3 +47,40 @@ def test_rxmatrix():
4747 DSS .Text .Command = f'? Line.ourline{ r_or_x } .{ r_or_x } matrix'
4848 assert DSS .Text .Result == '[11 |22 33 |44 55 66 ]'
4949
50+
51+ def test_create_no_circuit ():
52+ general_classes = (
53+ 'CNData' , 'DynamicExp' , 'GrowthShape' , 'LineSpacing' , 'LoadShape' , 'PriceShape' , 'Spectrum' ,
54+ 'TShape' , 'TCC_Curve' , 'TSData' , 'XfmrCode' , 'XYcurve' , 'WireData' ,
55+ )
56+ for cls in DSS .Classes :
57+ DSS .ClearAll ()
58+
59+ if cls in general_classes :
60+ DSS .Text .Command = f'new { cls } .test'
61+ else :
62+ with pytest .raises (DSSException , match = r'\(#(279)|(265)\)' ):
63+ DSS .Text .Command = f'new { cls } .test'
64+ pytest .fail (f'Object of type "{ cls } " was allowed to be created without a circuit!' )
65+
66+
67+ def test_create_with_circuit ():
68+ for cls in DSS .Classes :
69+ DSS .ClearAll ()
70+ DSS .NewCircuit (f'test_{ cls } ' )
71+ if cls in ('CapControl' , 'RegControl' , 'GenDispatcher' , 'StorageController' , 'Relay' , 'Fuse' , 'SwtControl' , 'ESPVLControl' , 'GICsource' ):
72+ with pytest .raises (DSSException ):
73+ DSS .Text .Command = f'new { cls } .test{ cls } '
74+
75+ DSS .Text .Command = f'new Transformer.testtr'
76+ DSS .Text .Command = f'new Capacitor.testcap'
77+ if cls == 'RegControl' :
78+ DSS .Text .Command = f'new { cls } .test{ cls } 2 transformer=testtr'
79+ elif cls == 'CapControl' :
80+ DSS .Text .Command = f'new { cls } .test{ cls } 2 element=transformer.testtr capacitor=testcap'
81+ elif cls == 'GenDispatcher' :
82+ DSS .Text .Command = f'new { cls } .test{ cls } 2 element=transformer.testtr'
83+
84+ else :
85+ DSS .Text .Command = f'new { cls } .test{ cls } '
86+
0 commit comments