Andreas Stührk avatar Andreas Stührk committed 71dfc03

Even more tests.

Comments (0)

Files changed (1)

bpython/test/test_repl.py

         """Set current input line of the test REPL."""
         self.repl.input_line = line
 
+    def test_func_name(self):
+        for (line, expected_name) in [("spam(", "spam"),
+                                      ("spam(map([]", "map"),
+                                      ("spam((), ", "spam")]:
+            self.setInputLine(line)
+            self.assertTrue(self.repl.get_args())
+            self.assertEqual(self.repl.current_func.__name__, expected_name)
+
+    def test_syntax_error_parens(self):
+        for line in ["spam(]", "spam([)", "spam())"]:
+            self.setInputLine(line)
+            # Should not explode
+            self.repl.get_args()
+
     def test_kw_arg_position(self):
         self.setInputLine("spam(a=0")
         self.assertTrue(self.repl.get_args())
         # Argument position
         self.assertEqual(self.repl.argspec[3], 1)
 
+    def test_name_in_assignment_without_spaces(self):
+        # Issue #127
+        self.setInputLine("x=range(")
+        self.assertTrue(self.repl.get_args())
+        self.assertEqual(self.repl.current_func.__name__, "range")
+
+    def test_nonexistent_name(self):
+        self.setInputLine("spamspamspam(")
+        self.assertFalse(self.repl.get_args())
+
 
 if __name__ == '__main__':
     unittest.main()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.