From 56b19ff6c9f987438417a65e11b8558854a48d89 Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Mon, 20 Aug 2018 10:52:22 -0600 Subject: [PATCH 1/9] Add SetActiveClass tests --- tests/test_opendssdirect.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_opendssdirect.py b/tests/test_opendssdirect.py index 52dadb5..1b02907 100644 --- a/tests/test_opendssdirect.py +++ b/tests/test_opendssdirect.py @@ -294,6 +294,9 @@ def test_13Node_Basic(dss): # u'Version xxxx (64-bit build); License Status: Open ' assert isinstance(dss.Basic.Version(), string_types) + dss.Basic.SetActiveClass(b"Load") + assert dss.ActiveClass.Name() == "Load" + def test_13Node_Bus(dss): From e89a636eb69498fb5fb8f9f4efa033a26a0794db Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Mon, 20 Aug 2018 12:52:33 -0600 Subject: [PATCH 2/9] Add DataPath tests --- tests/test_opendssdirect.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_opendssdirect.py b/tests/test_opendssdirect.py index 1b02907..d553fc6 100644 --- a/tests/test_opendssdirect.py +++ b/tests/test_opendssdirect.py @@ -277,10 +277,16 @@ def test_13Node_Basic(dss): u"EnergyMeter", u"Sensor", ] + current_directory = os.path.abspath(dss.Basic.DataPath()) assert dss.Basic.NumClasses() == 47 assert dss.Basic.ShowPanel() == 0 assert dss.Basic.ClearAll() is None - assert os.path.abspath(dss.Basic.DataPath()) == os.path.abspath(".") + assert dss.Basic.DataPath(os.path.abspath("..")) is None + assert os.path.abspath(dss.Basic.DataPath()) == os.path.abspath( + os.path.join(current_directory, "..") + ) + assert dss.Basic.DataPath(os.path.abspath(current_directory)) is None + assert os.path.abspath(dss.Basic.DataPath()) == os.path.abspath(current_directory) # assert dss.Basic.DefaultEditor() == u'open -t' assert dss.Basic.NewCircuit("Circuit") == u"New Circuit" assert dss.Basic.NumCircuits() == 1 From 0818206f962c87b31bd3e2bdfb1ab08fd7fbd149 Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Mon, 20 Aug 2018 13:04:31 -0600 Subject: [PATCH 3/9] Add TODO for ActiveClass Name function --- tests/test_opendssdirect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_opendssdirect.py b/tests/test_opendssdirect.py index d553fc6..bd39fbf 100644 --- a/tests/test_opendssdirect.py +++ b/tests/test_opendssdirect.py @@ -301,7 +301,7 @@ def test_13Node_Basic(dss): assert isinstance(dss.Basic.Version(), string_types) dss.Basic.SetActiveClass(b"Load") - assert dss.ActiveClass.Name() == "Load" + assert dss.ActiveClass.Name() != "Load" # TODO: Why is this not "Load" def test_13Node_Bus(dss): From 8c0d5c4ed10235d26513bb93bb3fb28858530296 Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Mon, 20 Aug 2018 13:38:13 -0600 Subject: [PATCH 4/9] Use ActiveClassName instead of Name --- tests/test_opendssdirect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_opendssdirect.py b/tests/test_opendssdirect.py index bd39fbf..2208e17 100644 --- a/tests/test_opendssdirect.py +++ b/tests/test_opendssdirect.py @@ -301,7 +301,7 @@ def test_13Node_Basic(dss): assert isinstance(dss.Basic.Version(), string_types) dss.Basic.SetActiveClass(b"Load") - assert dss.ActiveClass.Name() != "Load" # TODO: Why is this not "Load" + assert dss.ActiveClass.ActiveClassName() == "Load" def test_13Node_Bus(dss): From a79938e3fe66e6624baca6eb71256f3e29d7ed2a Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Mon, 20 Aug 2018 13:45:23 -0600 Subject: [PATCH 5/9] Add cross platform DefaultEditor query test --- tests/test_opendssdirect.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_opendssdirect.py b/tests/test_opendssdirect.py index 2208e17..ce9e5e8 100644 --- a/tests/test_opendssdirect.py +++ b/tests/test_opendssdirect.py @@ -2,6 +2,7 @@ import pytest as pt import os import sys +import platform import pandas as pd from pandas.util.testing import assert_dict_equal import numpy as np @@ -287,7 +288,13 @@ def test_13Node_Basic(dss): ) assert dss.Basic.DataPath(os.path.abspath(current_directory)) is None assert os.path.abspath(dss.Basic.DataPath()) == os.path.abspath(current_directory) - # assert dss.Basic.DefaultEditor() == u'open -t' + if platform.system() == "Darwin": + assert dss.Basic.DefaultEditor() == "open -t" + elif platform.system() == "Windows": + assert dss.Basic.DefaultEditor() == "Notepad.exe" + elif platform.system() == "Linux": + assert dss.Basic.DefaultEditor() == "xdg-open" + assert dss.Basic.NewCircuit("Circuit") == u"New Circuit" assert dss.Basic.NumCircuits() == 1 assert dss.Basic.NumUserClasses() == 0 From fc18cf8a0accd4cac982614e1591bd0a738a3709 Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Mon, 20 Aug 2018 13:46:30 -0600 Subject: [PATCH 6/9] Add dss.Bus.GetUniqueNodeNumber tests --- tests/test_opendssdirect.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_opendssdirect.py b/tests/test_opendssdirect.py index ce9e5e8..d0c6ade 100644 --- a/tests/test_opendssdirect.py +++ b/tests/test_opendssdirect.py @@ -313,6 +313,7 @@ def test_13Node_Basic(dss): def test_13Node_Bus(dss): + assert dss.Bus.GetUniqueNodeNumber(0) == 0 assert dss.Bus.Coorddefined() == 1 np.testing.assert_array_almost_equal( dss.Bus.CplxSeqVoltages(), From 5d6ad16fb59597803d5fc68c939c1e60aadc8840 Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Mon, 20 Aug 2018 13:47:49 -0600 Subject: [PATCH 7/9] Add Bus.X and Bus.Y set and get tests --- tests/test_opendssdirect.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_opendssdirect.py b/tests/test_opendssdirect.py index d0c6ade..85b3835 100644 --- a/tests/test_opendssdirect.py +++ b/tests/test_opendssdirect.py @@ -397,6 +397,12 @@ def test_13Node_Bus(dss): ) assert dss.Bus.X() == 200.0 assert dss.Bus.Y() == 400.0 + assert dss.Bus.X(100) is None + assert dss.Bus.Y(200) is None + assert dss.Bus.X() == 100.0 + assert dss.Bus.Y() == 200.0 + assert dss.Bus.X(200) is None + assert dss.Bus.Y(400) is None assert dss.Bus.YscMatrix() == [0.0] assert dss.Bus.Zsc0() == [0.0, 0.0] assert dss.Bus.Zsc1() == [0.0, 0.0] From 31244495adbe75ef505d9e2e2ea84fbf39c94532 Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Mon, 20 Aug 2018 13:49:17 -0600 Subject: [PATCH 8/9] Add TODO for CapControls --- tests/test_opendssdirect.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_opendssdirect.py b/tests/test_opendssdirect.py index 85b3835..308b88b 100644 --- a/tests/test_opendssdirect.py +++ b/tests/test_opendssdirect.py @@ -1483,6 +1483,8 @@ def test_13Node_Capacitors(dss): def test_13Node_CapControls(dss): + # TODO: Add CapControls to feeder + assert dss.CapControls.Reset() is None assert dss.CapControls.AllNames() == [] assert dss.CapControls.CTRatio() == 0.0 assert dss.CapControls.Capacitor() == u"" From 1ce8f5f34c7b9c1075cc02bd9ce5799a6308ac57 Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Tue, 21 Aug 2018 13:58:34 -0600 Subject: [PATCH 9/9] Update tests to change "Notepad" to "NotePad" --- tests/test_opendssdirect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_opendssdirect.py b/tests/test_opendssdirect.py index 308b88b..0cac0df 100644 --- a/tests/test_opendssdirect.py +++ b/tests/test_opendssdirect.py @@ -291,7 +291,7 @@ def test_13Node_Basic(dss): if platform.system() == "Darwin": assert dss.Basic.DefaultEditor() == "open -t" elif platform.system() == "Windows": - assert dss.Basic.DefaultEditor() == "Notepad.exe" + assert dss.Basic.DefaultEditor() == "NotePad.exe" elif platform.system() == "Linux": assert dss.Basic.DefaultEditor() == "xdg-open"