This commit is contained in:
@@ -47,33 +47,6 @@ def test_getattr():
|
||||
assert isinstance(timeout, (float, int))
|
||||
assert timeout == 3.0
|
||||
|
||||
# Have the get() method from (__getattr__) to get all the parameters in a dict
|
||||
get_method = pv.__getattr__('get')
|
||||
assert callable(get_method) # Check if it's really a function
|
||||
|
||||
result = get_method(timeout=3.0)
|
||||
assert isinstance(result, dict), "Expected dict because form='time'"
|
||||
|
||||
# Full check of expected fields
|
||||
assert 'value' in result
|
||||
assert 'timestamp' in result
|
||||
assert 'status' in result
|
||||
assert 'severity' in result
|
||||
|
||||
value = result['value']
|
||||
timestamp = result['timestamp']
|
||||
status = result['status']
|
||||
severity = result['severity']
|
||||
|
||||
assert isinstance(value, (int, float)), "Value should be numeric"
|
||||
assert isinstance(timestamp, (int, float)), "Timestamp should be numeric"
|
||||
assert isinstance(status, int), "Status should be int"
|
||||
assert isinstance(severity, int), "Severity should be int"
|
||||
|
||||
# Confirm PV not re-instantiated on second getattr
|
||||
second_get = pv.__getattr__('get')
|
||||
assert get_method is second_get
|
||||
|
||||
# Remove the instantiated PV
|
||||
del pv._pv
|
||||
pv._pv = None
|
||||
|
||||
Reference in New Issue
Block a user