summaryrefslogtreecommitdiff
path: root/test-cli/test/tests/qamper.py
diff options
context:
space:
mode:
Diffstat (limited to 'test-cli/test/tests/qamper.py')
-rw-r--r--test-cli/test/tests/qamper.py27
1 files changed, 9 insertions, 18 deletions
diff --git a/test-cli/test/tests/qamper.py b/test-cli/test/tests/qamper.py
index 2b02302..b3ab8b1 100644
--- a/test-cli/test/tests/qamper.py
+++ b/test-cli/test/tests/qamper.py
@@ -22,30 +22,21 @@ class Qamper(unittest.TestCase):
def execute(self):
amp = Amper()
- print(amp)
+ # open serial connection
if not amp.open():
- print("1")
self.fail("failed: can not open serial port")
return
-
+ # check if the amperimeter is connected and working
if not amp.hello():
- print("2")
self.fail("failed: can not communicate")
return
-
+ # get current value (in Amperes)
result = amp.getCurrent()
- print(result)
-
+ # close serial connection
amp.close()
+ # # In order to give a valid result it is importarnt to define an under current value
+ if result > float(self._overcurrent):
+ self.fail("failed: Overcurrent detected ( {} )".format(result))
-
-
-
-
-
- # # In order to give a valid result it is importarnt to define an under current value
- # if self._current > float(self._overcurrent):
- # self.fail("failed: OVERCURRENT DETECTED ( {} )".format(self._current))
- #
- # if self._current < float(self._undercurrent):
- # self.fail("failed: UNDERCURRENT DETECTED ( {} )".format(self._current))
+ if result < float(self._undercurrent):
+ self.fail("failed: Undercurrent detected ( {} )".format(result))