2020-02-03 17:25:54 +00:00
|
|
|
import unittest
|
|
|
|
|
2022-10-14 14:53:06 +00:00
|
|
|
from benedict.core import standardize as _standardize
|
|
|
|
|
2020-02-03 17:25:54 +00:00
|
|
|
|
|
|
|
class standardize_test_case(unittest.TestCase):
|
2022-02-13 10:35:43 +00:00
|
|
|
"""
|
|
|
|
This class describes a standardize test case.
|
|
|
|
"""
|
2020-02-03 17:25:54 +00:00
|
|
|
|
|
|
|
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,
|
2020-02-03 17:25:54 +00:00
|
|
|
},
|
2022-02-13 10:35:43 +00:00
|
|
|
" LocationHistoryCoordinates ": [
|
2020-02-03 17:25:54 +00:00
|
|
|
{
|
2022-02-13 10:35:43 +00:00
|
|
|
"Lat. ": 0.0,
|
|
|
|
"Lng. ": 0.0,
|
2020-02-03 17:25:54 +00:00
|
|
|
},
|
|
|
|
{
|
2022-02-13 10:35:43 +00:00
|
|
|
"Lat. ": 0.0,
|
|
|
|
"Lng. ": 0.0,
|
2020-02-03 17:25:54 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
}
|
|
|
|
_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,
|
2020-02-03 17:25:54 +00:00
|
|
|
},
|
2022-02-13 10:35:43 +00:00
|
|
|
"location_history_coordinates": [
|
2020-02-03 17:25:54 +00:00
|
|
|
{
|
2022-02-13 10:35:43 +00:00
|
|
|
"lat": 0.0,
|
|
|
|
"lng": 0.0,
|
2020-02-03 17:25:54 +00:00
|
|
|
},
|
|
|
|
{
|
2022-02-13 10:35:43 +00:00
|
|
|
"lat": 0.0,
|
|
|
|
"lng": 0.0,
|
2020-02-03 17:25:54 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
}
|
|
|
|
# print(_dump(d))
|
|
|
|
# print(_dump(r))
|
|
|
|
self.assertEqual(d, r)
|