no longer using orjson
This commit is contained in:
1 parent
f041346ad3
commit
e68a357e94
10 files changed
+36
-121
No files matched your search
@@ -6,9 +6,9 @@ from src.automations.types import (
|
||||
AutomationMetdata,
|
||||
)
|
||||
from src.automations.loader import load_automation
|
||||
from src.json_serializer import NOT_IMPLEMENTED_SV_MSG
|
||||
from src.yaml_serializer.types import (
|
||||
SecretValue,
|
||||
NOT_IMPLEMENTED_SV_MSG,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ from src.automations.parsers import (
|
||||
_parse_conditions,
|
||||
_parse_actions,
|
||||
)
|
||||
from src.json_serializer import NOT_IMPLEMENTED_SV_MSG
|
||||
from src.yaml_serializer.types import (
|
||||
SecretValue,
|
||||
NOT_IMPLEMENTED_SV_MSG,
|
||||
)
|
||||
|
||||
|
||||
@@ -220,80 +220,3 @@ class parser_tests(TestCase):
|
||||
|
||||
for expected, parsed in zip(expected_process, _parse_actions(raw_conditions)):
|
||||
self.assertEqual(parsed, expected)
|
||||
|
||||
# def test_overwriting_one_auto_in_separate_file(self):
|
||||
# # create dummy data
|
||||
# config_path = create_dummy_config_folder(
|
||||
# auto=[
|
||||
# AutomationData(
|
||||
# metadata=AutomationMetdata(
|
||||
# id="01",
|
||||
# )
|
||||
# ),
|
||||
# AutomationData(
|
||||
# metadata=AutomationMetdata(
|
||||
# id="02",
|
||||
# )
|
||||
# ),
|
||||
# AutomationData(
|
||||
# metadata=AutomationMetdata(
|
||||
# id="03",
|
||||
# )
|
||||
# ),
|
||||
# ]
|
||||
# )
|
||||
# # check the data is loaded well
|
||||
# automation_loader = AutomationLoader(load_hass_config(config_path))
|
||||
# self.assertEqual(automation_loader.get(0).metadata.id, "01")
|
||||
# self.assertEqual(automation_loader.get(1).metadata.id, "02")
|
||||
# self.assertEqual(automation_loader.get(2).metadata.id, "03")
|
||||
# self.assertIsNone(automation_loader.get(3))
|
||||
# self.assertEqual(len(automation_loader), 3)
|
||||
# # update auto #1
|
||||
# automation_loader.save(
|
||||
# 1,
|
||||
# AutomationData(
|
||||
# metadata=AutomationMetdata(id="02", alias="flush toilet!"),
|
||||
# trigger=[{"event": "toilet.flushed"}],
|
||||
# ),
|
||||
# )
|
||||
# # check that in-memory data is correctly updated
|
||||
# self.assertEqual(automation_loader.get(1).metadata.id, "02")
|
||||
# self.assertEqual(automation_loader.get(1).metadata.alias, "flush toilet!")
|
||||
# self.assertListEqual(automation_loader.get(1).trigger, [{"event": "toilet.flushed"}])
|
||||
|
||||
# # check that disk data is correctly updated
|
||||
# reloaded_automation_loader = AutomationLoader(load_hass_config(config_path))
|
||||
# self.assertEqual(len(automation_loader), 3)
|
||||
# self.assertEqual(reloaded_automation_loader.get(1).metadata.id, "02")
|
||||
# self.assertEqual(reloaded_automation_loader.get(1).metadata.alias, "flush toilet!")
|
||||
# self.assertListEqual(
|
||||
# reloaded_automation_loader.get(1).trigger, [{"event": "toilet.flushed"}]
|
||||
# )
|
||||
# # add new auto
|
||||
# automation_loader.save(
|
||||
# 3,
|
||||
# AutomationData(
|
||||
# metadata=AutomationMetdata(id="newest", alias="testing autos"),
|
||||
# sequence=[
|
||||
# AutomationConditionNode(condition="time", condition_data={"at": "10:00:00"})
|
||||
# ],
|
||||
# ),
|
||||
# )
|
||||
# # check that in-memory data is correctly updated
|
||||
# self.assertEqual(len(automation_loader), 4)
|
||||
# self.assertEqual(automation_loader.get(3).metadata.id, "newest")
|
||||
# self.assertEqual(automation_loader.get(3).metadata.alias, "testing autos")
|
||||
# self.assertListEqual(
|
||||
# automation_loader.get(3).sequence,
|
||||
# [AutomationConditionNode(condition="time", condition_data={"at": "10:00:00"})],
|
||||
# )
|
||||
# # check that disk data is correctly updated
|
||||
# reloaded_automation_loader = AutomationLoader(load_hass_config(config_path))
|
||||
# self.assertEqual(len(reloaded_automation_loader), 4)
|
||||
# self.assertEqual(reloaded_automation_loader.get(3).metadata.id, "newest")
|
||||
# self.assertEqual(reloaded_automation_loader.get(3).metadata.alias, "testing autos")
|
||||
# self.assertListEqual(
|
||||
# reloaded_automation_loader.get(3).sequence,
|
||||
# [AutomationConditionNode(condition="time", condition_data={"at": "10:00:00"})],
|
||||
# )
|
||||
@@ -4,8 +4,8 @@ from ruamel.yaml.scalarstring import ScalarString
|
||||
from ruamel.yaml.scalarint import ScalarInt
|
||||
from ruamel.yaml.scalarbool import ScalarBoolean
|
||||
from ruamel.yaml.scalarfloat import ScalarFloat
|
||||
from src.yaml_serializer.types import SecretValue
|
||||
from src.json_serializer import json_dumps, NOT_IMPLEMENTED_SV_MSG
|
||||
from src.yaml_serializer.types import SecretValue, NOT_IMPLEMENTED_SV_MSG
|
||||
from src.json_serializer import json_dumps
|
||||
|
||||
|
||||
class json_serializer_tests(TestCase):
|
||||
@@ -30,7 +30,6 @@ class json_serializer_tests(TestCase):
|
||||
"tup": (1, "w"),
|
||||
"some": {"deep": {"obj": NOT_IMPLEMENTED_SV_MSG}},
|
||||
},
|
||||
separators=(",", ":"),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -53,6 +52,5 @@ class json_serializer_tests(TestCase):
|
||||
"list": [1, "w"],
|
||||
"tup": (1, "w"),
|
||||
},
|
||||
separators=(",", ":"),
|
||||
),
|
||||
)
|
||||
@@ -1,5 +1,4 @@
|
||||
import io
|
||||
from pathlib import Path
|
||||
from unittest import TestCase
|
||||
from src.yaml_serializer import (
|
||||
dump_yaml,
|
||||
|
||||
Reference in new issue
Block a user