Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tests and docs to use non-deprecated functions #778

Merged
merged 3 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/source/using_traitlets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ properties.

class Nested(HasTraits):

value = Dict(traits={
'configuration': Dict(trait=Unicode()),
value = Dict(per_key_traits={
'configuration': Dict(value_trait=Unicode()),
'flag': Bool()
})

Expand Down
4 changes: 2 additions & 2 deletions traitlets/config/configurable.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def update_config(self, config):
def class_get_help(cls, inst=None):
"""Get the help string for this class in ReST format.

If `inst` is given, it's current trait values will be used in place of
If `inst` is given, its current trait values will be used in place of
class defaults.
"""
assert inst is None or isinstance(inst, cls)
Expand All @@ -255,7 +255,7 @@ def class_get_trait_help(cls, trait, inst=None, helptext=None):
"""Get the helptext string for a single trait.

:param inst:
If given, it's current trait values will be used in place of
If given, its current trait values will be used in place of
the class default.
:param helptext:
If not given, uses the `help` attribute of the current trait.
Expand Down
9 changes: 6 additions & 3 deletions traitlets/tests/test_traitlets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1910,7 +1910,7 @@ def test_dict_assignment():

class UniformlyValueValidatedDictTrait(HasTraits):

value = Dict(trait=Unicode(), default_value={"foo": "1"})
value = Dict(value_trait=Unicode(), default_value={"foo": "1"})


class TestInstanceUniformlyValueValidatedDict(TraitTestBase):
Expand All @@ -1924,7 +1924,7 @@ class TestInstanceUniformlyValueValidatedDict(TraitTestBase):

class NonuniformlyValueValidatedDictTrait(HasTraits):

value = Dict(traits={"foo": Int()}, default_value={"foo": 1})
value = Dict(per_key_traits={"foo": Int()}, default_value={"foo": 1})


class TestInstanceNonuniformlyValueValidatedDict(TraitTestBase):
Expand Down Expand Up @@ -1953,7 +1953,10 @@ class TestInstanceKeyValidatedDict(TraitTestBase):
class FullyValidatedDictTrait(HasTraits):

value = Dict(
trait=Unicode(), key_trait=Unicode(), traits={"foo": Int()}, default_value={"foo": 1}
value_trait=Unicode(),
key_trait=Unicode(),
per_key_traits={"foo": Int()},
default_value={"foo": 1},
)


Expand Down