Esempio n. 1
0
	def test_has_default(self):
		option = make_option('-e', '--example_opt', type='int',
 					help='Example int option without default value')
		obs = OptionInfo(option)
		self.assertFalse(obs.has_default())

		option = make_option('-e', '--example_opt', type='int', default=23,
 					help='Example int option with default value')
		obs = OptionInfo(option)
		self.assertTrue(obs.has_default())
Esempio n. 2
0
	def test_is_short_command_line(self):
		option = make_option('-e', '--example_opt', type='string',
 					help='Example string option')
		obj = OptionInfo(option)
		self.assertTrue(obj.is_short_command_line())

		# Test of an option whithout short opt
		option = make_option('--example_opt', type='string',
 					help='Example string option')
		obj = OptionInfo(option)
		self.assertFalse(obj.is_short_command_line())

		# Test of an option whithout long opt
		option = make_option('-e', type='string',
 					help='Example string option')
		obj = OptionInfo(option)
		self.assertTrue(obj.is_short_command_line())
Esempio n. 3
0
	def test_get_command_line_string(self):
		option = make_option('-e', '--example_opt', type='string',
 					help='Example string option')
		obj = OptionInfo(option)
		obs = obj.get_command_line_string()
		self.assertEqual(obs, '-e')

		# Test of an option whithout short opt
		option = make_option('--example_opt', type='string',
 					help='Example string option')
		obj = OptionInfo(option)
		obs = obj.get_command_line_string()
		self.assertEqual(obs, '--example_opt')

		# Test of an option whithout long opt
		option = make_option('-e', type='string',
 					help='Example string option')
		obj = OptionInfo(option)
		obs = obj.get_command_line_string()
		self.assertEqual(obs, '-e')