-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from moneymeets/feature/refactor-identifiers-g…
…enerators Feature/refactor identifiers generators
- Loading branch information
Showing
3 changed files
with
31 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from spec2sdk.generators.identifiers import make_class_name, make_constant_name, make_identifier, make_variable_name | ||
|
||
|
||
def test_remove_invalid_leading_characters(): | ||
assert make_identifier("12+34-_56Variable78Name90") == "Variable78Name90" | ||
|
||
|
||
def test_replace_invalid_characters(): | ||
assert make_identifier("Variable12%#&34(@!56Name78*-,") == "Variable12_34_56Name78" | ||
|
||
|
||
def test_python_keywords(): | ||
assert make_identifier("def") == "def_" | ||
|
||
|
||
def test_make_class_name(): | ||
assert make_class_name("issue:comment") == "IssueComment" | ||
|
||
|
||
def test_make_constant_name(): | ||
assert make_constant_name("family_status") == "FAMILY_STATUS" | ||
|
||
|
||
def test_make_variable_name(): | ||
assert make_variable_name("UserID") == "user_id" |