python-benedict/tests/core/test_standardize.py

62 lines
1.6 KiB
Python
Raw Normal View History

import unittest
from benedict.core import standardize as _standardize
class standardize_test_case(unittest.TestCase):
2022-02-13 10:35:43 +00:00
"""
This class describes a standardize test case.
"""
def test_standardize(self):
d = {
2022-02-13 10:35:43 +00:00
"CamelCase": 1,
"CamelCamelCase": 1,
"Camel2Camel2Case": 1,
"getHTTPResponseCode": 1,
"get2HTTPResponseCode": 1,
"HTTPResponseCode": 1,
"HTTPResponseCodeXYZ": 1,
" LocationCoordinates ": {
"Lat. ": 0.0,
"Lng. ": 0.0,
},
2022-02-13 10:35:43 +00:00
" LocationHistoryCoordinates ": [
{
2022-02-13 10:35:43 +00:00
"Lat. ": 0.0,
"Lng. ": 0.0,
},
{
2022-02-13 10:35:43 +00:00
"Lat. ": 0.0,
"Lng. ": 0.0,
},
],
}
_standardize(d)
r = {
2022-02-13 10:35:43 +00:00
"camel_case": 1,
"camel_camel_case": 1,
"camel2_camel2_case": 1,
"get_http_response_code": 1,
"get2_http_response_code": 1,
"http_response_code": 1,
"http_response_code_xyz": 1,
"location_coordinates": {
"lat": 0.0,
"lng": 0.0,
},
2022-02-13 10:35:43 +00:00
"location_history_coordinates": [
{
2022-02-13 10:35:43 +00:00
"lat": 0.0,
"lng": 0.0,
},
{
2022-02-13 10:35:43 +00:00
"lat": 0.0,
"lng": 0.0,
},
],
}
# print(_dump(d))
# print(_dump(r))
self.assertEqual(d, r)