Esempio n. 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')
Esempio n. 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')
Esempio n. 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')
Esempio n. 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)
Esempio n. 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')
Esempio n. 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)
Esempio n. 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))
Esempio n. 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')
Esempio n. 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)
Esempio n. 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')
Esempio n. 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')
Esempio n. 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')
Esempio n. 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)
Esempio n. 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))
Esempio n. 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'])
Esempio n. 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')