示例#1
0
 def test_get_parser_ignore_multiple(self):
     parser = get_parser('prog', ['ignored-dirs'], ['exts'])
     options = parser.parse_args([
         '--ignore', 'abc', '--ignore', 'def', 'command is this'
     ])
     self.assertEqual(options.ignore, ['ignored-dirs', 'abc', 'def'])
     self.assertEqual(options.command, 'command is this')
示例#2
0
 def test_get_parser_command_with_options_in_it(self):
     parser = get_parser('prog', ['ignored-dirs'], ['exts'])
     options = parser.parse_args(['ls --color'])
     self.assertEqual(options.command, 'ls --color')
示例#3
0
 def test_get_parser_verbose(self):
     parser = get_parser('prog', ['ignored-dirs'], ['exts'])
     options = parser.parse_args(['--verbose', 'command is this'])
     self.assertTrue(options.verbose)
     self.assertEqual(options.command, 'command is this')
示例#4
0
 def test_get_parser_defaults(self):
     parser = get_parser('prog', ['ignored-dirs'], ['exts'])
     options = parser.parse_args(['command is this'])
     self.assertEqual(options.ignore, ['ignored-dirs'])
     self.assertEqual(options.interactive, False)
示例#5
0
 def test_get_parser_one_command(self):
     parser = get_parser('prog', ['ignored-dirs'], ['exts'])
     options = parser.parse_args(['single command arg'])
     self.assertEqual(options.command, 'single command arg')
示例#6
0
 def test_get_parser_interactive(self):
     parser = get_parser('prog', ['ignored-dirs'], ['exts'])
     parser.exit = Mock()
     options = parser.parse_args(['--interactive', 'command is this'])
     self.assertEqual(options.interactive, True)
示例#7
0
 def assert_get_parser_error(self, args, expected, stream):
     parser = get_parser('prog', ['ignored-dirs'], ['exts'])
     with self.assertRaises(SystemExit):
         parser.parse_args(args)
     self.assertEqual(stream.write.call_args, call(expected))
示例#8
0
 def test_get_parser_ignore_multiple(self):
     parser = get_parser('prog', ['ignored-dirs'], ['exts'])
     options = parser.parse_args(
         ['--ignore', 'abc', '--ignore', 'def', 'command is this'])
     self.assertEqual(options.ignore, ['ignored-dirs', 'abc', 'def'])
     self.assertEqual(options.command, 'command is this')
示例#9
0
 def test_get_parser_interactive(self):
     parser = get_parser('prog', ['ignored-dirs'], ['exts'])
     parser.exit = Mock()
     options = parser.parse_args(['--interactive', 'command is this'])
     self.assertEqual(options.interactive, True)
示例#10
0
 def test_get_parser_command_with_options_in_it(self):
     parser = get_parser('prog', ['ignored-dirs'], ['exts'])
     options = parser.parse_args(['ls --color'])
     self.assertEqual(options.command, 'ls --color')
示例#11
0
 def test_get_parser_verbose(self):
     parser = get_parser('prog', ['ignored-dirs'], ['exts'])
     options = parser.parse_args(['--verbose', 'command is this'])
     self.assertTrue(options.verbose)
     self.assertEqual(options.command, 'command is this')
示例#12
0
 def test_get_parser_one_command(self):
     parser = get_parser('prog', ['ignored-dirs'], ['exts'])
     options = parser.parse_args(['single command arg'])
     self.assertEqual(options.command, 'single command arg')
示例#13
0
 def test_get_parser_defaults(self):
     parser = get_parser('prog', ['ignored-dirs'], ['exts'])
     options = parser.parse_args(['command is this'])
     self.assertEqual(options.ignore, ['ignored-dirs'])
     self.assertEqual(options.interactive, False)
示例#14
0
 def assert_get_parser_error(self, args, expected, stream):
     parser = get_parser('prog', ['ignored-dirs'], ['exts'])
     with self.assertRaises(SystemExit):
         parser.parse_args(args)
     self.assertEqual(stream.write.call_args, call(expected))
示例#15
0
 def test_get_parser_ignore_default(self):
     parser = get_parser('prog', ['dirs'], ['exts'])
     options = parser.parse_args(['command is this'])
     self.assertEqual(options.ignore, ['dirs'])
示例#16
0
 def test_get_parser_ignore(self):
     parser = get_parser('prog', ['dirs'], ['exts'])
     parser.exit = Mock()
     options = parser.parse_args(['--ignore', 'abc', 'command is this'])
     self.assertEqual(options.ignore, ['dirs', 'abc'])
     self.assertEqual(options.command, 'command is this')