Skip to content

Commit

Permalink
implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
Jared-Newell-Mobility committed Feb 8, 2024
1 parent 7f1d59e commit 4a8fee0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Change log
- [#601](https://github.com/mobilityhouse/ocpp/issues/601) Correct SoC to be uppercase except for when occurring first (PEP 8 mixedCase)
- [#557](https://github.com/mobilityhouse/ocpp/issues/557) OCPP 2.0.1 Wrong data type in CostUpdated total_cost
- [#564](https://github.com/mobilityhouse/ocpp/issues/564) Add support For Python 3.11 and 3.12
- [#583](https://github.com/mobilityhouse/ocpp/issues/583) OCPP v1.6/v2.0.1 deprecate dataclasses from calls and call results with the suffix 'Payload'
Expand Down
2 changes: 1 addition & 1 deletion ocpp/charge_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def snake_to_camel_case(data):
if isinstance(data, dict):
camel_case_dict = {}
for key, value in data.items():
key = key.replace("soc", "SoC")
key = key.replace("soc", "SOC").replace("_SOCket", "Socket")
key = key.replace("_v2x", "V2X")
components = key.split("_")
key = components[0] + "".join(x[:1].upper() + x[1:] for x in components[1:])
Expand Down
6 changes: 4 additions & 2 deletions tests/test_charge_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ def heartbeat(self, **kwargs):
"test_input,expected",
[
({"transactionId": "74563478"}, {"transaction_id": "74563478"}),
({"fullSoC": 100}, {"full_soc": 100}),
({"fullSOC": 100}, {"full_soc": 100}),
({"evMinV2XEnergyRequest": 200}, {"ev_min_v2x_energy_request": 200}),
({"v2xChargingCtrlr": 200}, {"v2x_charging_ctrlr": 200}),
({"webSocketPingInterval": 200}, {"web_socket_ping_interval": 200}),
],
)
def test_camel_to_snake_case(test_input, expected):
Expand All @@ -65,9 +66,10 @@ def test_camel_to_snake_case(test_input, expected):
"test_input,expected",
[
({"transaction_id": "74563478"}, {"transactionId": "74563478"}),
({"full_soc": 100}, {"fullSoC": 100}),
({"full_soc": 100}, {"fullSOC": 100}),
({"ev_min_v2x_energy_request": 200}, {"evMinV2XEnergyRequest": 200}),
({"v2x_charging_ctrlr": 200}, {"v2xChargingCtrlr": 200}),
({"web_socket_ping_interval": 200}, {"webSocketPingInterval": 200}),
],
)
def test_snake_to_camel_case(test_input, expected):
Expand Down

0 comments on commit 4a8fee0

Please sign in to comment.