Skip to content

Commit

Permalink
Merge 1e974fd into 472f9af
Browse files Browse the repository at this point in the history
  • Loading branch information
jlstevens committed Jan 23, 2020
2 parents 472f9af + 1e974fd commit a299160
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions param/parameterized.py
Expand Up @@ -1062,7 +1062,7 @@ class Parameters(object):
class or the instance as necessary.
"""

_disable_stubs = None # Flag used to disable stubs in the API1 tests
_disable_stubs = False # Flag used to disable stubs in the API1 tests
# None for no action, True to raise and False to warn.

def __init__(self_, cls, self=None):
Expand Down Expand Up @@ -1309,9 +1309,10 @@ def params(self_, parameter_name=None):
Includes Parameters from this class and its
superclasses.
"""
if self_.self is not None and self_.self._instance__params:
if (self_.self is not None and self_.self._instance__params
and self_._disable_stubs is None):
self_.warning('The Parameterized instance has instance '
'parameters created using new-style param '
'parameters created using the new-style param '
'APIs, which are incompatible with .params. '
'Use the new more explicit APIs on the '
'.param accessor to query parameter instances.'
Expand Down Expand Up @@ -2794,7 +2795,7 @@ def instance(self_or_cls,**params):
cls = self_or_cls
else:
p = params
params = dict(self_or_cls.get_param_values())
params = dict(self_or_cls.param.get_param_values())
params.update(p)
params.pop('name')
cls = self_or_cls.__class__
Expand Down
5 changes: 3 additions & 2 deletions tests/API1/testparameterizedobject.py
Expand Up @@ -233,8 +233,9 @@ def test_instance_param_objects_warn_on_params(self):
inst.param['inst']

inst.param.params()
self.log_handler.assertContains(
'WARNING', 'The Parameterized instance has instance parameters')
if param.parameterized.Parameters._disable_stubs is None:
self.log_handler.assertContains(
'WARNING', 'The Parameterized instance has instance parameters')


def test_instance_param_getitem(self):
Expand Down

0 comments on commit a299160

Please sign in to comment.