Beispiel #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')
Beispiel #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')
Beispiel #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')
Beispiel #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)
Beispiel #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')
Beispiel #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)
Beispiel #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))
Beispiel #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')
Beispiel #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)
Beispiel #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')
Beispiel #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')
Beispiel #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')
Beispiel #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)
Beispiel #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))
Beispiel #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'])
Beispiel #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')