summaryrefslogtreecommitdiff
path: root/tests/test_parsing.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-04-17 19:30:18 -0700
committerTodd Leonhardt <todd.leonhardt@gmail.com>2018-04-17 19:30:18 -0700
commit9697bf1858c6ef06e13bdfd3dfaea6d0376d9a6a (patch)
treecaef34b8dbc7389b249876d182e1ec6629f02db3 /tests/test_parsing.py
parentb3e6625001e64a2516eba33ca526d45e25d1ca5f (diff)
downloadcmd2-git-9697bf1858c6ef06e13bdfd3dfaea6d0376d9a6a.tar.gz
Cleaned up __init__.py
Removed things which were only needed for unit tests from __init__.py - Converted to importing from cmd2.cmd2.<foo> within the relevant unit tests
Diffstat (limited to 'tests/test_parsing.py')
-rw-r--r--tests/test_parsing.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/tests/test_parsing.py b/tests/test_parsing.py
index e2367a37..2682ec68 100644
--- a/tests/test_parsing.py
+++ b/tests/test_parsing.py
@@ -16,8 +16,8 @@ import pytest
@pytest.fixture
def hist():
- from cmd2 import HistoryItem
- h = cmd2.History([HistoryItem('first'), HistoryItem('second'), HistoryItem('third'), HistoryItem('fourth')])
+ from cmd2.cmd2 import HistoryItem
+ h = cmd2.cmd2.History([HistoryItem('first'), HistoryItem('second'), HistoryItem('third'), HistoryItem('fourth')])
return h
# Case-sensitive parser
@@ -25,12 +25,12 @@ def hist():
def parser():
c = cmd2.Cmd()
c.multilineCommands = ['multiline']
- c.parser_manager = cmd2.ParserManager(redirector=c.redirector, terminators=c.terminators,
- multilineCommands=c.multilineCommands, legalChars=c.legalChars,
- commentGrammars=c.commentGrammars, commentInProgress=c.commentInProgress,
- blankLinesAllowed=c.blankLinesAllowed, prefixParser=c.prefixParser,
- preparse=c.preparse, postparse=c.postparse, aliases=c.aliases,
- shortcuts=c.shortcuts)
+ c.parser_manager = cmd2.cmd2.ParserManager(redirector=c.redirector, terminators=c.terminators,
+ multilineCommands=c.multilineCommands, legalChars=c.legalChars,
+ commentGrammars=c.commentGrammars, commentInProgress=c.commentInProgress,
+ blankLinesAllowed=c.blankLinesAllowed, prefixParser=c.prefixParser,
+ preparse=c.preparse, postparse=c.postparse, aliases=c.aliases,
+ shortcuts=c.shortcuts)
return c.parser_manager.main_parser
# Case-sensitive ParserManager
@@ -38,12 +38,12 @@ def parser():
def cs_pm():
c = cmd2.Cmd()
c.multilineCommands = ['multiline']
- c.parser_manager = cmd2.ParserManager(redirector=c.redirector, terminators=c.terminators,
- multilineCommands=c.multilineCommands, legalChars=c.legalChars,
- commentGrammars=c.commentGrammars, commentInProgress=c.commentInProgress,
- blankLinesAllowed=c.blankLinesAllowed, prefixParser=c.prefixParser,
- preparse=c.preparse, postparse=c.postparse, aliases=c.aliases,
- shortcuts=c.shortcuts)
+ c.parser_manager = cmd2.cmd2.ParserManager(redirector=c.redirector, terminators=c.terminators,
+ multilineCommands=c.multilineCommands, legalChars=c.legalChars,
+ commentGrammars=c.commentGrammars, commentInProgress=c.commentInProgress,
+ blankLinesAllowed=c.blankLinesAllowed, prefixParser=c.prefixParser,
+ preparse=c.preparse, postparse=c.postparse, aliases=c.aliases,
+ shortcuts=c.shortcuts)
return c.parser_manager
@@ -77,7 +77,7 @@ def test_history_get(hist):
def test_cast():
- cast = cmd2.cast
+ cast = cmd2.cmd2.cast
# Boolean
assert cast(True, True) == True
@@ -101,7 +101,7 @@ def test_cast():
def test_cast_problems(capsys):
- cast = cmd2.cast
+ cast = cmd2.cmd2.cast
expected = 'Problem setting parameter (now {}) to {}; incorrect type?\n'
@@ -327,8 +327,8 @@ def test_parse_input_redirect_from_unicode_filename(input_parser):
def test_empty_statement_raises_exception():
app = cmd2.Cmd()
- with pytest.raises(cmd2.EmptyStatement):
+ with pytest.raises(cmd2.cmd2.EmptyStatement):
app._complete_statement('')
- with pytest.raises(cmd2.EmptyStatement):
+ with pytest.raises(cmd2.cmd2.EmptyStatement):
app._complete_statement(' ')