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

Method test_mro_discovery

tests/config/test_application.py:136–175  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

134 assert app.name == "set_via_constructor"
135
136 def test_mro_discovery(self):
137 app = MyApp()
138
139 self.assertSequenceEqual(
140 class_to_names(app._classes_with_config_traits()),
141 ["Application", "MyApp", "Bar", "Foo"],
142 )
143 self.assertSequenceEqual(
144 class_to_names(app._classes_inc_parents()),
145 [
146 "Configurable",
147 "LoggingConfigurable",
148 "SingletonConfigurable",
149 "Application",
150 "MyApp",
151 "Bar",
152 "Foo",
153 ],
154 )
155
156 self.assertSequenceEqual(
157 class_to_names(app._classes_with_config_traits([Application])), ["Application"]
158 )
159 self.assertSequenceEqual(
160 class_to_names(app._classes_inc_parents([Application])),
161 ["Configurable", "LoggingConfigurable", "SingletonConfigurable", "Application"],
162 )
163
164 self.assertSequenceEqual(class_to_names(app._classes_with_config_traits([Foo])), ["Foo"])
165 self.assertSequenceEqual(
166 class_to_names(app._classes_inc_parents([Bar])), ["Configurable", "Bar"]
167 )
168
169 class MyApp2(Application): # no defined `classes` attr
170 pass
171
172 self.assertSequenceEqual(class_to_names(app._classes_with_config_traits([Foo])), ["Foo"])
173 self.assertSequenceEqual(
174 class_to_names(app._classes_inc_parents([Bar])), ["Configurable", "Bar"]
175 )
176
177 def test_config(self):
178 app = MyApp()

Callers

nothing calls this directly

Calls 4

class_to_namesFunction · 0.85
_classes_inc_parentsMethod · 0.80
MyAppClass · 0.70

Tested by

no test coverage detected