##// END OF EJS Templates
Sort and unique %config results
Sang Min Park -
Show More
@@ -108,8 +108,9 b' class ConfigMagics(Magics):'
108 108 # some IPython objects are Configurable, but do not yet have
109 109 # any configurable traits. Exclude them from the effects of
110 110 # this magic, as their presence is just noise:
111 configurables = [ c for c in self.shell.configurables
112 if c.__class__.class_traits(config=True) ]
111 configurables = sorted(set([ c for c in self.shell.configurables
112 if c.__class__.class_traits(config=True)
113 ]), key=lambda x: x.__class__.__name__)
113 114 classnames = [ c.__class__.__name__ for c in configurables ]
114 115
115 116 line = s.strip()
@@ -80,6 +80,24 b' def test_config():'
80 80 ## should not raise.
81 81 _ip.magic('config')
82 82
83 def test_config_available_configs():
84 """ test that config magic prints available configs in unique and
85 sorted order. """
86 with capture_output() as captured:
87 _ip.magic('config')
88
89 stdout = captured.stdout
90 config_classes = stdout.strip().split('\n')[1:]
91 nt.assert_list_equal(config_classes, sorted(set(config_classes)))
92
93 def test_config_print_class():
94 """ test that config with a classname prints the class's options. """
95 with capture_output() as captured:
96 _ip.magic('config TerminalInteractiveShell')
97
98 stdout = captured.stdout
99 nt.assert_in("TerminalInteractiveShell options", stdout)
100
83 101 def test_rehashx():
84 102 # clear up everything
85 103 _ip.alias_manager.clear_aliases()
General Comments 0
You need to be logged in to leave comments. Login now