##// END OF EJS Templates
Sort and unique %config results
Sang Min Park -
Show More
@@ -108,8 +108,9 b' class ConfigMagics(Magics):'
108 # some IPython objects are Configurable, but do not yet have
108 # some IPython objects are Configurable, but do not yet have
109 # any configurable traits. Exclude them from the effects of
109 # any configurable traits. Exclude them from the effects of
110 # this magic, as their presence is just noise:
110 # this magic, as their presence is just noise:
111 configurables = [ c for c in self.shell.configurables
111 configurables = sorted(set([ c for c in self.shell.configurables
112 if c.__class__.class_traits(config=True) ]
112 if c.__class__.class_traits(config=True)
113 ]), key=lambda x: x.__class__.__name__)
113 classnames = [ c.__class__.__name__ for c in configurables ]
114 classnames = [ c.__class__.__name__ for c in configurables ]
114
115
115 line = s.strip()
116 line = s.strip()
@@ -80,6 +80,24 b' def test_config():'
80 ## should not raise.
80 ## should not raise.
81 _ip.magic('config')
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 def test_rehashx():
101 def test_rehashx():
84 # clear up everything
102 # clear up everything
85 _ip.alias_manager.clear_aliases()
103 _ip.alias_manager.clear_aliases()
General Comments 0
You need to be logged in to leave comments. Login now