Skip to content

Commit

Permalink
nficano#151 adds test case for camelize dictionary with snake_case ke…
Browse files Browse the repository at this point in the history
…ys and dashed values
  • Loading branch information
orchowski committed Feb 13, 2022
1 parent f0e3fe0 commit 27bd9d3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_camelize.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
("field_value_2_type", "fieldValue2Type"),
],
)


def test_camelize(input_str, expected_output):
"""
:param input_str: String that will be transformed.
Expand Down Expand Up @@ -73,6 +75,10 @@ def test_camelize_dict_list():
"_APIResponse_": "test_acronym",
"__APIResponse__": "test_acronym",
},
{
"test_date": "2022-02-14",
"test_uuid": "9e3f4a89-9989-4190-89a0-f50ffa3826db",
},
],
}
)
Expand Down Expand Up @@ -105,6 +111,24 @@ def test_camelize_dict_list():
"_APIResponse_": "test_acronym",
"__APIResponse__": "test_acronym",
},
{
"testDate": "2022-02-14",
"testUuid": "9e3f4a89-9989-4190-89a0-f50ffa3826db",
},
],
}
assert actual == expected

def test_camelize_dict():
actual = {
"test_date": "2022-02-14",
"test_uuid": "9e3f4a89-9989-4190-89a0-f50ffa3826db",
}
expected = {
"testDate": "2022-02-14",
"testUuid": "9e3f4a89-9989-4190-89a0-f50ffa3826db",
}

result = humps.camelize(actual)

assert expected == result

0 comments on commit 27bd9d3

Please sign in to comment.