Skip to content

Commit

Permalink
fix some codacy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jenshnielsen committed Jun 10, 2020
1 parent 24edb79 commit a9a4dec
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
6 changes: 3 additions & 3 deletions qcodes/tests/parameter/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def get_raw(self):
return self.cache._raw_value
return self.cache.raw_value

def set_raw(self, raw_value):
def set_raw(self, value):
pass


Expand Down Expand Up @@ -135,7 +135,7 @@ def get_func():
if func is not None:
val = func()
else:
val = self.cache._raw_value
val = self.cache.raw_value
self.get_values.append(val)
return val
return get_func
6 changes: 4 additions & 2 deletions qcodes/tests/parameter/test_parameter_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
def test_get_from_cache_does_not_trigger_real_get_if_get_if_invalid_false():
"""
assert that calling get on the cache with get_if_invalid=False does
not trigger a get of the parameter when parameter has expired due to max_val_age
not trigger a get of the parameter when parameter
has expired due to max_val_age
"""
param = BetterGettableParam(name="param", max_val_age=1)
param.get()
Expand All @@ -34,7 +35,8 @@ def test_initial_set_with_without_cache():


def test_set_initial_and_initial_cache_raises():
with pytest.raises(SyntaxError, match="`initial_value` and `initial_cache_value`"):
with pytest.raises(SyntaxError,
match="`initial_value` and `initial_cache_value`"):
Parameter(name="param", initial_value=1, initial_cache_value=2)


Expand Down
12 changes: 8 additions & 4 deletions qcodes/tests/parameter/test_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ def wrapped_func(*args, **kwargs):
return wrapped_func

p.get = wrap_in_call_counter(p.get)
assert p.get.call_count() == 0 # type: ignore[attr-defined] # pre-condition
# pre-condition
assert p.get.call_count() == 0 # type: ignore[attr-defined]
else:
assert not hasattr(p, 'get') # pre-condition
# pre-condition
assert not hasattr(p, 'get')
assert not p.gettable

if cache_is_valid:
Expand Down Expand Up @@ -176,7 +178,8 @@ def test_snapshot_when_snapshot_value_is_false(
snapshot_get, get_cmd, cache_is_valid, update):

p = create_parameter(
snapshot_get=snapshot_get, snapshot_value=False, get_cmd=get_cmd, cache_is_valid=cache_is_valid)
snapshot_get=snapshot_get, snapshot_value=False,
get_cmd=get_cmd, cache_is_valid=cache_is_valid)

if update != NOT_PASSED:
s = p.snapshot(update=update)
Expand Down Expand Up @@ -253,7 +256,8 @@ def test_snapshot_of_non_gettable_parameter_mirrors_cache(
assert s['raw_value'] is None


def test_snapshot_of_gettable_parameter_depends_on_update(update, cache_is_valid):
def test_snapshot_of_gettable_parameter_depends_on_update(update,
cache_is_valid):
p = create_parameter(
snapshot_get=True, snapshot_value=True, get_cmd=lambda: 69,
cache_is_valid=cache_is_valid, offset=4)
Expand Down

0 comments on commit a9a4dec

Please sign in to comment.