예제 #1
0
 def test_exception_type(self, value, expected):
     with pytest.raises(expected):
         sanitize_js_var_name(value)
예제 #2
0
 def test_normal_invalid_first_char_x2(self, value, replace_text, expected):
     sanitized_name = sanitize_js_var_name(value, replace_text)
     assert sanitized_name == expected
     validate_js_var_name(sanitized_name)
예제 #3
0
 def test_normal_reserved(self, value, expected):
     assert sanitize_js_var_name(value) == expected
예제 #4
0
    def get_variable_name(self, value):
        import pathvalidate

        return pathvalidate.sanitize_js_var_name(value, "_").lower()