Exemplo n.º 1
0
 def test_options_not_allowed(self):
     with self.assertRaises(CmdLineInputError) as cm:
         prepare_options_allowed(["d=1", "a=2", "c=3", "b=4"], ["a", "b"])
     self.assertEqual(
         str(cm.exception),
         "Unknown options 'c', 'd'"
     )
Exemplo n.º 2
0
 def test_options_not_allowed(self):
     with self.assertRaises(CmdLineInputError) as cm:
         prepare_options_allowed(["d=1", "a=2", "c=3", "b=4"], ["a", "b"])
     self.assertEqual(
         str(cm.exception),
         "Unknown options 'c', 'd'"
     )
Exemplo n.º 3
0
 def test_option_not_allowed(self):
     with self.assertRaises(CmdLineInputError) as cm:
         prepare_options_allowed(["a=1"], [])
     self.assertEqual(
         str(cm.exception),
         "Unknown option 'a'"
     )
Exemplo n.º 4
0
 def test_option_not_allowed(self):
     with self.assertRaises(CmdLineInputError) as cm:
         prepare_options_allowed(["a=1"], [])
     self.assertEqual(
         str(cm.exception),
         "Unknown option 'a'"
     )
Exemplo n.º 5
0
 def test_allow_repeatable(self):
     self.assertEqual(
         {"a": ["1", "2"]},
         prepare_options_allowed(
             ["a=1", "a=2"], ["a"], allowed_repeatable_options=("a")
         ),
     )
Exemplo n.º 6
0
 def test_prepare_option_dict_form_args(self):
     self.assertEqual(
         {
             "a": "b",
             "c": "d"
         },
         prepare_options_allowed(["a=b", "c=d"], ["a", "c"]),
     )
Exemplo n.º 7
0
 def test_allow_repeatable(self):
     self.assertEqual(
         {'a': ['1', '2']},
         prepare_options_allowed(
             ["a=1", "a=2"],
             ["a"],
             allowed_repeatable_options=("a")
         )
     )
Exemplo n.º 8
0
 def test_allow_repeatable(self):
     self.assertEqual(
         {'a': ['1', '2']},
         prepare_options_allowed(
             ["a=1", "a=2"],
             ["a"],
             allowed_repeatable_options=("a")
         )
     )
Exemplo n.º 9
0
 def test_prepare_option_dict_with_empty_value(self):
     self.assertEqual({"a": ""}, prepare_options_allowed(["a="], "a"))
Exemplo n.º 10
0
 def test_accept_options_with_same_key_and_same_value(self):
     self.assertEqual(
         {'a': '1'},
         prepare_options_allowed(["a=1", "a=1"], ["a"]))
Exemplo n.º 11
0
 def test_refuse_options_with_same_key_and_differend_value(self):
     self.assertRaises(
         CmdLineInputError,
         lambda: prepare_options_allowed(['a=a', "a=b"], ["a"]))
Exemplo n.º 12
0
 def test_prepare_option_dict_with_empty_value(self):
     self.assertEqual({'a': ''}, prepare_options_allowed(['a='], "a"))
Exemplo n.º 13
0
 def test_prepare_option_dict_form_args(self):
     self.assertEqual(
         {'a': 'b', 'c': 'd'},
         prepare_options_allowed(['a=b', 'c=d'], ["a", "c"]))
Exemplo n.º 14
0
 def test_refuse_option_without_value(self):
     self.assertRaises(
         CmdLineInputError, lambda: prepare_options_allowed(['abc'], ["abc"])
     )
Exemplo n.º 15
0
 def test_refuse_option_without_value(self):
     self.assertRaises(CmdLineInputError,
                       lambda: prepare_options_allowed(['abc'], ["abc"]))
Exemplo n.º 16
0
 def test_prepare_option_dict_form_args(self):
     self.assertEqual({
         'a': 'b',
         'c': 'd'
     }, prepare_options_allowed(['a=b', 'c=d'], ["a", "c"]))
Exemplo n.º 17
0
 def test_prepare_option_dict_with_empty_value(self):
     self.assertEqual({'a': ''}, prepare_options_allowed(['a='], "a"))
Exemplo n.º 18
0
 def test_refuse_option_without_key(self):
     self.assertRaises(CmdLineInputError,
                       lambda: prepare_options_allowed(['=a'], ["a"]))
Exemplo n.º 19
0
 def test_refuse_option_without_key(self):
     self.assertRaises(
         CmdLineInputError, lambda: prepare_options_allowed(['=a'], ["a"])
     )
Exemplo n.º 20
0
 def test_accept_options_with_same_key_and_same_value(self):
     self.assertEqual({'a': '1'},
                      prepare_options_allowed(["a=1", "a=1"], ["a"]))
Exemplo n.º 21
0
 def test_refuse_options_with_same_key_and_differend_value(self):
     self.assertRaises(
         CmdLineInputError,
         lambda: prepare_options_allowed(['a=a', "a=b"], ["a"])
     )