コード例 #1
0
 def test_normal(self, value):
     validate_js_var_name(value)
コード例 #2
0
 def test_exception_invalid_char(self, value):
     with pytest.raises(InvalidCharError):
         validate_js_var_name(value)
コード例 #3
0
 def test_exception_reserved(self, value, expected):
     with pytest.raises(expected) as e:
         validate_js_var_name(value)
     assert e.value.reusable_name is False
コード例 #4
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)
コード例 #5
0
 def test_exception_invalid_char(self, value):
     with pytest.raises(ValidationError) as e:
         validate_js_var_name(value)
     assert e.value.reason == ErrorReason.INVALID_CHARACTER
コード例 #6
0
 def test_exception_type(self, value, expected):
     with pytest.raises(expected):
         validate_js_var_name(value)
コード例 #7
0
 def test_normal(self, value):
     validate_js_var_name(value)
コード例 #8
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)
コード例 #9
0
 def test_exception_reserved(self, value, expected):
     with pytest.raises(ValidationError) as e:
         validate_js_var_name(value)
     assert e.value.reason == expected
     assert e.value.reusable_name is False
コード例 #10
0
 def test_exception_type(self, value, expected):
     with pytest.raises(expected):
         validate_js_var_name(value)
コード例 #11
0
 def test_exception_invalid_char(self, value):
     with pytest.raises(InvalidCharError):
         validate_js_var_name(value)