def test_single_simple_mod_argument(self) -> None: res = parse_language_and_options("curl, mod=1") self.assertEqual(res, ("curl", {"mod": 1})) res = parse_language_and_options("curl, mod='somevalue'") self.assertEqual(res, ("curl", {"mod": "somevalue"})) res = parse_language_and_options("curl, mod=\"somevalue\"") self.assertEqual(res, ("curl", {"mod": "somevalue"}))
def test_single_list_mod_argument(self) -> None: res = parse_language_and_options("curl, exclude=['param1', 'param2']") self.assertEqual(res, ("curl", {"exclude": ["param1", "param2"]})) res = parse_language_and_options('curl, exclude=["param1", "param2"]') self.assertEqual(res, ("curl", {"exclude": ["param1", "param2"]})) res = parse_language_and_options("curl, exclude=['param1', \"param2\"]") self.assertEqual(res, ("curl", {"exclude": ["param1", "param2"]}))
def test_multiple_simple_mod_argument(self) -> None: res = parse_language_and_options("curl, mod1=1, mod2='a'") self.assertEqual(res, ("curl", {"mod1": 1, "mod2": "a"})) res = parse_language_and_options( "curl, mod1=\"asdf\", mod2='thing', mod3=3") self.assertEqual(res, ("curl", { "mod1": "asdf", "mod2": "thing", "mod3": 3 }))
def test_multiple_list_mod_argument(self) -> None: res = parse_language_and_options( "curl, exclude=['param1', \"param2\"], special=['param3']") self.assertEqual(res, ("curl", { "exclude": ["param1", "param2"], "special": ["param3"] }))
def test_multiple_mixed_mod_arguments(self) -> None: res = parse_language_and_options( "curl, exclude=[\"asdf\", 'sdfg'], other_key='asdf', more_things=\"asdf\", another_list=[1, \"2\"]" ) self.assertEqual(res, ("curl", { "exclude": ["asdf", "sdfg"], "other_key": "asdf", "more_things": "asdf", "another_list": [1, "2"] }))
def test_multiple_mixed_mod_arguments(self) -> None: res = parse_language_and_options( 'curl, exclude=["asdf", \'sdfg\'], other_key=\'asdf\', more_things="asdf", another_list=[1, "2"]' ) self.assertEqual( res, ( "curl", { "exclude": ["asdf", "sdfg"], "other_key": "asdf", "more_things": "asdf", "another_list": [1, "2"], }, ), )
def test_no_mod_argument(self) -> None: res = parse_language_and_options("python") self.assertEqual(res, ("python", {}))