Skip to content

Commit 57d09ea

Browse files
committed
adding check for default values
1 parent d7917fe commit 57d09ea

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tools/checkspecs.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,12 @@ def test_specs(self, uri):
272272
if key == 'mandatory' and trait.mandatory is not None and not trait.mandatory:
273273
bad_specs.append(
274274
[uri, c, 'Inputs', traitname, 'mandatory=False'])
275+
# checking if traits that have default_value different that the trits default one
276+
# also have `usedefault` specified; excluding Enum, since it always has default value
277+
if trait.trait_type.__class__.__name__ != "Enum"\
278+
and trait.default and "usedefault" not in trait.__dict__:
279+
bad_specs.append(
280+
[uri, c, 'Inputs', traitname, 'default value is set, no value for usedefault'])
275281

276282
if not classinst.output_spec:
277283
continue

0 commit comments

Comments
 (0)