Skip to content

Commit 0f423b0

Browse files
committed
Add test
1 parent 0bb503f commit 0f423b0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/test_utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import pytest
2+
13
from openapi_python_client import utils
24

35

@@ -34,3 +36,10 @@ def test_no_string_escapes():
3436

3537
def test__fix_keywords():
3638
assert utils.fix_keywords("None") == "None_"
39+
40+
41+
def to_valid_python_identifier():
42+
assert utils.to_valid_python_identifier("valid") == "valid"
43+
assert utils.to_valid_python_identifier("1") == "field_1"
44+
with pytest.raises(ValueError):
45+
utils.to_valid_python_identifier("&")

0 commit comments

Comments
 (0)