MCPcopy Create free account
hub / github.com/ipython/traitlets / test_deep_alias

Function test_deep_alias

tests/config/test_application.py:780–805  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

778
779
780def test_deep_alias():
781 from traitlets import Int
782 from traitlets.config import Application, Configurable
783
784 class Foo(Configurable):
785 val = Int(default_value=5).tag(config=True)
786
787 class Bar(Configurable):
788 def __init__(self, *args, **kwargs):
789 super().__init__(*args, **kwargs)
790 self.foo = Foo(parent=self)
791
792 class TestApp(Application):
793 name = "test"
794
795 aliases = {"val": "Bar.Foo.val"}
796 classes = [Foo, Bar]
797
798 def initialize(self, *args, **kwargs):
799 super().initialize(*args, **kwargs)
800 self.bar = Bar(parent=self)
801
802 app = TestApp()
803 app.initialize(["--val=10"])
804 assert app.bar.foo.val == 10
805 assert len(list(app.emit_alias_help())) > 0
806
807
808def test_logging_config(tmp_path, capsys):

Callers

nothing calls this directly

Calls 3

initializeMethod · 0.95
emit_alias_helpMethod · 0.80
TestAppClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…