summaryrefslogtreecommitdiff
path: root/tests/test_parsing.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-02-23 23:34:38 -0500
committerTodd Leonhardt <todd.leonhardt@gmail.com>2018-02-23 23:34:38 -0500
commit2f37b1d54fcda2b8f3fb42b27515004a00b24a72 (patch)
treeba092f1a96967b86ec880b05d9a934c342bf67c1 /tests/test_parsing.py
parent656a7742f0f15bf64f259e4f32b1d0a082fcfc83 (diff)
downloadcmd2-git-2f37b1d54fcda2b8f3fb42b27515004a00b24a72.tar.gz
Converted a few class variables into instance variables
Now that users can nest instances of cmd.Cmd2 to support creating sub-menus, we should need to be more careful about class vs instance variables to prevent potential problems. This converts the following former class variables into instance variables: - multiline_commands - shortcuts - exclude_from_help - exclude_from_history In the process, a couple camelCase variable names got converted to pep8_compliant names. There may be a few other class variables which should be converted to instance variables. But at the very least, this is a good start. This closes #273.
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 da8f6692..561b48ec 100644
--- a/tests/test_parsing.py
+++ b/tests/test_parsing.py
@@ -24,39 +24,39 @@ def hist():
@pytest.fixture
def parser():
c = cmd2.Cmd()
- c.multilineCommands = ['multiline']
+ c.multiline_commands = ['multiline']
c.case_insensitive = True
- c.parser_manager = cmd2.ParserManager(redirector=c.redirector, terminators=c.terminators, multilineCommands=c.multilineCommands,
- legalChars=c.legalChars, commentGrammars=c.commentGrammars,
- commentInProgress=c.commentInProgress, case_insensitive=c.case_insensitive,
- blankLinesAllowed=c.blankLinesAllowed, prefixParser=c.prefixParser,
- preparse=c.preparse, postparse=c.postparse, shortcuts=c.shortcuts)
+ c.parser_manager = cmd2.ParserManager(redirector=c.redirector, terminators=c.terminators, multilineCommands=c.multiline_commands,
+ legalChars=c.legalChars, commentGrammars=c.commentGrammars,
+ commentInProgress=c.commentInProgress, case_insensitive=c.case_insensitive,
+ blankLinesAllowed=c.blankLinesAllowed, prefixParser=c.prefixParser,
+ preparse=c.preparse, postparse=c.postparse, shortcuts=c.shortcuts)
return c.parser_manager.main_parser
# Case-insensitive ParserManager
@pytest.fixture
def ci_pm():
c = cmd2.Cmd()
- c.multilineCommands = ['multiline']
+ c.multiline_commands = ['multiline']
c.case_insensitive = True
- c.parser_manager = cmd2.ParserManager(redirector=c.redirector, terminators=c.terminators, multilineCommands=c.multilineCommands,
- legalChars=c.legalChars, commentGrammars=c.commentGrammars,
- commentInProgress=c.commentInProgress, case_insensitive=c.case_insensitive,
- blankLinesAllowed=c.blankLinesAllowed, prefixParser=c.prefixParser,
- preparse=c.preparse, postparse=c.postparse, shortcuts=c.shortcuts)
+ c.parser_manager = cmd2.ParserManager(redirector=c.redirector, terminators=c.terminators, multilineCommands=c.multiline_commands,
+ legalChars=c.legalChars, commentGrammars=c.commentGrammars,
+ commentInProgress=c.commentInProgress, case_insensitive=c.case_insensitive,
+ blankLinesAllowed=c.blankLinesAllowed, prefixParser=c.prefixParser,
+ preparse=c.preparse, postparse=c.postparse, shortcuts=c.shortcuts)
return c.parser_manager
# Case-sensitive ParserManager
@pytest.fixture
def cs_pm():
c = cmd2.Cmd()
- c.multilineCommands = ['multiline']
+ c.multiline_commands = ['multiline']
c.case_insensitive = False
- c.parser_manager = cmd2.ParserManager(redirector=c.redirector, terminators=c.terminators, multilineCommands=c.multilineCommands,
- legalChars=c.legalChars, commentGrammars=c.commentGrammars,
- commentInProgress=c.commentInProgress, case_insensitive=c.case_insensitive,
- blankLinesAllowed=c.blankLinesAllowed, prefixParser=c.prefixParser,
- preparse=c.preparse, postparse=c.postparse, shortcuts=c.shortcuts)
+ c.parser_manager = cmd2.ParserManager(redirector=c.redirector, terminators=c.terminators, multilineCommands=c.multiline_commands,
+ legalChars=c.legalChars, commentGrammars=c.commentGrammars,
+ commentInProgress=c.commentInProgress, case_insensitive=c.case_insensitive,
+ blankLinesAllowed=c.blankLinesAllowed, prefixParser=c.prefixParser,
+ preparse=c.preparse, postparse=c.postparse, shortcuts=c.shortcuts)
return c.parser_manager