X Tutup
Skip to content

Commit 1eaac2c

Browse files
test argspec painting
1 parent 22717d3 commit 1eaac2c

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

bpython/test/test_curtsies_painting.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
from curtsies.fmtfuncs import cyan, bold, green, yellow, on_magenta, red
1414
from bpython.curtsiesfrontend.events import RefreshRequestEvent
1515

16-
from bpython import config
16+
from bpython import config, inspection
1717
from bpython.curtsiesfrontend.repl import Repl
18+
from bpython.curtsiesfrontend import replpainter
1819
from bpython.repl import History
1920
from bpython.curtsiesfrontend.repl import INCONSISTENT_HISTORY_MSG, CONTIGUITY_BROKEN_MSG
2021

@@ -79,6 +80,20 @@ def test_completion(self):
7980
u'Welcome to bpython! Press <F1> f']
8081
self.assert_paint_ignoring_formatting(screen, (0, 4))
8182

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+
8297
@contextmanager
8398
def output_to_repl(repl):
8499
old_out, old_err = sys.stdout, sys.stderr

0 commit comments

Comments
 (0)
X Tutup