Skip to content
Snippets Groups Projects
Commit 87589844 authored by Taya Snijder's avatar Taya Snijder
Browse files

removed read_RW_test unit test function, as the RW now use the same code as the read only points

parent 0fa78731
Branches
Tags
1 merge request!197Resolve L2SS-363 "01 12 2021 get rw values from hardware"
...@@ -368,47 +368,6 @@ class TestAttributeTypes(base.TestCase): ...@@ -368,47 +368,6 @@ class TestAttributeTypes(base.TestCase):
print(" Test passed! Managed to write: ".format(val)) print(" Test passed! Managed to write: ".format(val))
def read_RW_test(self, dev, dtype, test_type):
'''Test device'''
expected = None
val = None
try:
with DeviceTestContext(dev, process=True) as proxy:
#initialise
proxy.initialise()
proxy.on()
if test_type == "scalar":
expected = numpy.zeros((1,), dtype=dtype)
val = proxy.scalar_RW
elif test_type == "spectrum":
expected = numpy.zeros(spectrum_dims, dtype=dtype)
val = proxy.spectrum_RW
elif test_type == "image":
expected = numpy.zeros(image_dims, dtype=dtype)
val = numpy.array(proxy.image_RW) #is needed for STR since they act differently
# cant use all() for 2d arrays so instead compare the dimensions and then flatten to 2d
self.assertEqual(val.shape, expected.shape, " image R array dimensions got mangled. Expected {}, got {}".format(expected.shape, val.shape))
val.reshape(-1)
else:
self.assertEqual(1,2, " {} is not a valid test_type. please use either scalar, spectrum or image".format(test_type))
if test_type != "scalar":
# spectrums and the now flattened images can be compared with .all()
comparison = expected == val
equal_arrays = comparison.all()
self.assertTrue(equal_arrays, " Value could not be handled by the atrribute_wrappers internal RW storer")
else:
comparison = expected == val
self.assertTrue(comparison, " Value could not be handled by the atrribute_wrappers internal RW storer")
print(" Test passed! Managed to read internal RW value. got: {}".format(val))
except Exception as e:
info = "Test failure in {} {} read RW test. Expected: {}, got {}".format(test_type, dtype, expected, val)
raise Exception(info) from e
def readback_test(self, dev, dtype, test_type): def readback_test(self, dev, dtype, test_type):
'''Test device''' '''Test device'''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment