From d4c50252890136e3e1f701fef0b60d53ee9f9a65 Mon Sep 17 00:00:00 2001 From: Ogi Moore Date: Tue, 6 Apr 2021 11:51:10 -0700 Subject: [PATCH] Implement suggested changes from ixjlyons --- .../parametertree/tests/test_Parameter.py | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/pyqtgraph/parametertree/tests/test_Parameter.py b/pyqtgraph/parametertree/tests/test_Parameter.py index 69dca1ff..e0c5a985 100644 --- a/pyqtgraph/parametertree/tests/test_Parameter.py +++ b/pyqtgraph/parametertree/tests/test_Parameter.py @@ -9,33 +9,23 @@ def test_parameter_hasdefault(): # default unspecified p = Parameter(**opts) assert p.hasDefault() + assert p.defaultValue() == opts["value"] - p.setDefault(1) + p.setDefault(2) assert p.hasDefault() - assert p.defaultValue() == 1 + assert p.defaultValue() == 2 # default specified p = Parameter(default=0, **opts) assert p.hasDefault() assert p.defaultValue() == 0 - -@pytest.mark.parametrize('passdefault', [True, False]) -def test_parameter_hasdefault_none(passdefault): - # test that Parameter essentially ignores defualt=None, same as not passing - # a default at all - opts = {'name': 'param', 'type': int, 'value': 0} - if passdefault: - opts['default'] = None - - p = Parameter(**opts) - assert p.hasDefault() != passdefault - defaultCmp = None if passdefault else p.value() - assert p.defaultValue() == defaultCmp - - p.setDefault(None) + # default specified as None + p = Parameter(default=None, **opts) assert not p.hasDefault() + + def test_unpack_parameter(): # test that **unpacking correctly returns child name/value maps params = [