##// END OF EJS Templates
Set litteral
Rémy Léone -
Show More
@@ -3178,7 +3178,7 b' class InteractiveShell(SingletonConfigurable):'
3178 ns = {}
3178 ns = {}
3179 import_pylab(ns, import_all)
3179 import_pylab(ns, import_all)
3180 # warn about clobbered names
3180 # warn about clobbered names
3181 ignored = set(["__builtins__"])
3181 ignored = {"__builtins__"}
3182 both = set(ns).intersection(self.user_ns).difference(ignored)
3182 both = set(ns).intersection(self.user_ns).difference(ignored)
3183 clobbered = [ name for name in both if self.user_ns[name] is not ns[name] ]
3183 clobbered = [ name for name in both if self.user_ns[name] is not ns[name] ]
3184 self.user_ns.update(ns)
3184 self.user_ns.update(ns)
@@ -63,7 +63,7 b' class Test_magic_run_completer(unittest.TestCase):'
63 event = MockEvent(u"%run aa")
63 event = MockEvent(u"%run aa")
64 mockself = None
64 mockself = None
65 match = set(magic_run_completer(mockself, event))
65 match = set(magic_run_completer(mockself, event))
66 self.assertEqual(match, set([u"aao.py"]))
66 self.assertEqual(match, {u"aao.py"})
67
67
68 def test_3(self):
68 def test_3(self):
69 """Test magic_run_completer with unterminated " """
69 """Test magic_run_completer with unterminated " """
@@ -109,7 +109,7 b' class Test_magic_run_completer_nonascii(unittest.TestCase):'
109 event = MockEvent(u"%run a")
109 event = MockEvent(u"%run a")
110 mockself = None
110 mockself = None
111 match = set(magic_run_completer(mockself, event))
111 match = set(magic_run_completer(mockself, event))
112 self.assertEqual(match, set([u"a.py", u"aaø.py"]))
112 self.assertEqual(match, {u"a.py", u"aaø.py"})
113
113
114 @onlyif_unicode_paths
114 @onlyif_unicode_paths
115 def test_2(self):
115 def test_2(self):
@@ -118,7 +118,7 b' class Test_magic_run_completer_nonascii(unittest.TestCase):'
118 event = MockEvent(u"%run aa")
118 event = MockEvent(u"%run aa")
119 mockself = None
119 mockself = None
120 match = set(magic_run_completer(mockself, event))
120 match = set(magic_run_completer(mockself, event))
121 self.assertEqual(match, set([u"aaø.py"]))
121 self.assertEqual(match, {u"aaø.py"})
122
122
123 @onlyif_unicode_paths
123 @onlyif_unicode_paths
124 def test_3(self):
124 def test_3(self):
@@ -126,14 +126,14 b' class Test_magic_run_completer_nonascii(unittest.TestCase):'
126 event = MockEvent(u'%run "a')
126 event = MockEvent(u'%run "a')
127 mockself = None
127 mockself = None
128 match = set(magic_run_completer(mockself, event))
128 match = set(magic_run_completer(mockself, event))
129 self.assertEqual(match, set([u"a.py", u"aaø.py"]))
129 self.assertEqual(match, {u"a.py", u"aaø.py"})
130
130
131 # module_completer:
131 # module_completer:
132
132
133 def test_import_invalid_module():
133 def test_import_invalid_module():
134 """Testing of issue https://github.com/ipython/ipython/issues/1107"""
134 """Testing of issue https://github.com/ipython/ipython/issues/1107"""
135 invalid_module_names = set(['foo-bar', 'foo:bar', '10foo'])
135 invalid_module_names = {'foo-bar', 'foo:bar', '10foo'}
136 valid_module_names = set(['foobar'])
136 valid_module_names = {'foobar'}
137 with TemporaryDirectory() as tmpdir:
137 with TemporaryDirectory() as tmpdir:
138 sys.path.insert( 0, tmpdir )
138 sys.path.insert( 0, tmpdir )
139 for name in invalid_module_names | valid_module_names:
139 for name in invalid_module_names | valid_module_names:
@@ -645,12 +645,12 b' class TestAstTransform(unittest.TestCase):'
645
645
646 with tt.AssertPrints("best of "):
646 with tt.AssertPrints("best of "):
647 ip.run_line_magic("timeit", "-n1 f(1)")
647 ip.run_line_magic("timeit", "-n1 f(1)")
648 self.assertEqual(called, set([-1]))
648 self.assertEqual(called, {-1})
649 called.clear()
649 called.clear()
650
650
651 with tt.AssertPrints("best of "):
651 with tt.AssertPrints("best of "):
652 ip.run_cell_magic("timeit", "-n1 f(2)", "f(3)")
652 ip.run_cell_magic("timeit", "-n1 f(2)", "f(3)")
653 self.assertEqual(called, set([-2, -3]))
653 self.assertEqual(called, {-2, -3})
654
654
655 def test_time(self):
655 def test_time(self):
656 called = []
656 called = []
@@ -718,12 +718,12 b' class TestAstTransform2(unittest.TestCase):'
718
718
719 with tt.AssertPrints("best of "):
719 with tt.AssertPrints("best of "):
720 ip.run_line_magic("timeit", "-n1 f(1)")
720 ip.run_line_magic("timeit", "-n1 f(1)")
721 self.assertEqual(called, set([(1,)]))
721 self.assertEqual(called, {(1,)})
722 called.clear()
722 called.clear()
723
723
724 with tt.AssertPrints("best of "):
724 with tt.AssertPrints("best of "):
725 ip.run_cell_magic("timeit", "-n1 f(2)", "f(3)")
725 ip.run_cell_magic("timeit", "-n1 f(2)", "f(3)")
726 self.assertEqual(called, set([(2,), (3,)]))
726 self.assertEqual(called, {(2,), (3,)})
727
727
728 class ErrorTransformer(ast.NodeTransformer):
728 class ErrorTransformer(ast.NodeTransformer):
729 """Throws an error when it sees a number."""
729 """Throws an error when it sees a number."""
@@ -799,12 +799,12 b' def test_user_variables():'
799 ip.display_formatter.active_types = ip.display_formatter.format_types
799 ip.display_formatter.active_types = ip.display_formatter.format_types
800
800
801 ip.user_ns['dummy'] = d = DummyRepr()
801 ip.user_ns['dummy'] = d = DummyRepr()
802 keys = set(['dummy', 'doesnotexist'])
802 keys = {'dummy', 'doesnotexist'}
803 r = ip.user_expressions({ key:key for key in keys})
803 r = ip.user_expressions({ key:key for key in keys})
804
804
805 nt.assert_equal(keys, set(r.keys()))
805 nt.assert_equal(keys, set(r.keys()))
806 dummy = r['dummy']
806 dummy = r['dummy']
807 nt.assert_equal(set(['status', 'data', 'metadata']), set(dummy.keys()))
807 nt.assert_equal({'status', 'data', 'metadata'}, set(dummy.keys()))
808 nt.assert_equal(dummy['status'], 'ok')
808 nt.assert_equal(dummy['status'], 'ok')
809 data = dummy['data']
809 data = dummy['data']
810 metadata = dummy['metadata']
810 metadata = dummy['metadata']
@@ -832,7 +832,7 b' def test_user_expression():'
832 pprint.pprint(r)
832 pprint.pprint(r)
833 nt.assert_equal(set(r.keys()), set(query.keys()))
833 nt.assert_equal(set(r.keys()), set(query.keys()))
834 a = r['a']
834 a = r['a']
835 nt.assert_equal(set(['status', 'data', 'metadata']), set(a.keys()))
835 nt.assert_equal({'status', 'data', 'metadata'}, set(a.keys()))
836 nt.assert_equal(a['status'], 'ok')
836 nt.assert_equal(a['status'], 'ok')
837 data = a['data']
837 data = a['data']
838 metadata = a['metadata']
838 metadata = a['metadata']
@@ -144,7 +144,7 b' def test_list_profiles_in():'
144 break
144 break
145 if dec.unicode_paths:
145 if dec.unicode_paths:
146 nt.assert_true(found_unicode)
146 nt.assert_true(found_unicode)
147 nt.assert_equal(set(profiles), set(['foo', 'hello']))
147 nt.assert_equal(set(profiles), {'foo', 'hello'})
148
148
149
149
150 def test_list_bundled_profiles():
150 def test_list_bundled_profiles():
General Comments 0
You need to be logged in to leave comments. Login now