示例#1
0
    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"}))
示例#2
0
    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"]}))
示例#3
0
    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
        }))
示例#4
0
 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"]
     }))
示例#5
0
 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"]
     }))
示例#6
0
 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"],
             },
         ),
     )
示例#7
0
 def test_no_mod_argument(self) -> None:
     res = parse_language_and_options("python")
     self.assertEqual(res, ("python", {}))