diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_parsing.py | 21 | ||||
-rw-r--r-- | tests/test_transcript.py | 12 |
2 files changed, 7 insertions, 26 deletions
diff --git a/tests/test_parsing.py b/tests/test_parsing.py index a3b601db..dda29911 100644 --- a/tests/test_parsing.py +++ b/tests/test_parsing.py @@ -43,27 +43,6 @@ def test_remaining_args(): assert cmd2.remaining_args('-f bar bar cow', ['bar', 'cow']) == 'bar cow' -def test_stubborn_dict_class(): - d = cmd2.StubbornDict(large='gross', small='klein') - assert sorted(d.items()) == [('large', 'gross'), ('small', 'klein')] - - d.append(['plain', ' plaid']) - assert sorted(d.items()) == [('large', 'gross'), ('plaid', ''), ('plain', ''), ('small', 'klein')] - - d += ' girl Frauelein, Maedchen\n\n shoe schuh' - assert sorted(d.items()) == [('girl', 'Frauelein, Maedchen'), ('large', 'gross'), ('plaid', ''), ('plain', ''), - ('shoe', 'schuh'), ('small', 'klein')] - -def test_stubborn_dict_factory(): - assert sorted(cmd2.stubborn_dict('cow a bovine\nhorse an equine').items()) == [('cow', 'a bovine'), - ('horse', 'an equine')] - assert sorted(cmd2.stubborn_dict(['badger', 'porcupine a poky creature']).items()) == [('badger', ''), - ('porcupine', - 'a poky creature')] - assert sorted(cmd2.stubborn_dict(turtle='has shell', frog='jumpy').items()) == [('frog', 'jumpy'), - ('turtle', 'has shell')] - - def test_history_span(hist): h = hist assert h.span('-2..') == ['third', 'fourth'] diff --git a/tests/test_transcript.py b/tests/test_transcript.py index 4b6f4c99..a31ebd17 100644 --- a/tests/test_transcript.py +++ b/tests/test_transcript.py @@ -20,14 +20,16 @@ from conftest import run_cmd, StdOut, normalize class CmdLineApp(Cmd): - multilineCommands = ['orate'] - maxrepeats = 3 - redirector = '->' - def __init__(self, *args, **kwargs): + self.multilineCommands = ['orate'] + self.maxrepeats = 3 + self.redirector = '->' + + # Add stuff to settable and/or shortcuts before calling base class initializer + self.settable['maxrepeats'] = 'Max number of `--repeat`s allowed' + # Need to use this older form of invoking super class constructor to support Python 2.x and Python 3.x Cmd.__init__(self, *args, **kwargs) - self.settable.append('maxrepeats Max number of `--repeat`s allowed') # Configure how arguments are parsed for @options commands set_posix_shlex(False) |