|
13 | 13 | from curtsies.fmtfuncs import cyan, bold, green, yellow, on_magenta, red |
14 | 14 | from bpython.curtsiesfrontend.events import RefreshRequestEvent |
15 | 15 |
|
16 | | -from bpython import config |
| 16 | +from bpython import config, inspection |
17 | 17 | from bpython.curtsiesfrontend.repl import Repl |
| 18 | +from bpython.curtsiesfrontend import replpainter |
18 | 19 | from bpython.repl import History |
19 | 20 | from bpython.curtsiesfrontend.repl import INCONSISTENT_HISTORY_MSG, CONTIGUITY_BROKEN_MSG |
20 | 21 |
|
@@ -79,6 +80,20 @@ def test_completion(self): |
79 | 80 | u'Welcome to bpython! Press <F1> f'] |
80 | 81 | self.assert_paint_ignoring_formatting(screen, (0, 4)) |
81 | 82 |
|
| 83 | + def test_argspec(self): |
| 84 | + def foo(x, y, z=10): |
| 85 | + "docstring!" |
| 86 | + pass |
| 87 | + argspec = inspection.getargspec('foo', foo) + [1] |
| 88 | + array = replpainter.formatted_argspec(argspec, 30, setup_config()) |
| 89 | + screen = [(bold(cyan(u'foo'))+cyan(':')+cyan(' ')+cyan('(')+cyan('x') + |
| 90 | + yellow(',')+yellow(' ')+bold(cyan('y'))+yellow(',') + |
| 91 | + yellow(' ')+cyan('z')+yellow('=')+bold(cyan('10'))+yellow(')'))] |
| 92 | + print screen |
| 93 | + print array |
| 94 | + self.assertFSArraysEqual(fsarray(array), fsarray(screen)) |
| 95 | + |
| 96 | + |
82 | 97 | @contextmanager |
83 | 98 | def output_to_repl(repl): |
84 | 99 | old_out, old_err = sys.stdout, sys.stderr |
|
0 commit comments