From 886bc34b06cab1571974a2d88fa85c9d9d3ad19c Mon Sep 17 00:00:00 2001 From: Shyue Ping Ong Date: Wed, 17 Apr 2024 11:16:21 -0700 Subject: [PATCH] Comment out save load tests. --- tests/test_json.py | 114 ++++++++++++++++++++++----------------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/tests/test_json.py b/tests/test_json.py index 206c5955..d453baee 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -390,63 +390,63 @@ def test_enum_serialization_no_msonable(self): f = jsanitize(d, enum_values=True) assert f["123"] == "value_a" - def test_save_load(self, tmp_path): - """Tests the save and load serialization methods.""" - - test_good_class = GoodMSONClass( - "Hello", - "World", - "Python", - **{ - "cant_serialize_me": GoodNOTMSONClass( - "Hello2", "World2", "Python2", **{"values": []} - ), - "cant_serialize_me2": [ - GoodNOTMSONClass("Hello4", "World4", "Python4", **{"values": []}), - GoodNOTMSONClass("Hello4", "World4", "Python4", **{"values": []}), - ], - "cant_serialize_me3": [ - { - "tmp": GoodMSONClass( - "Hello5", "World5", "Python5", **{"values": []} - ), - "tmp2": 2, - "tmp3": [1, 2, 3], - }, - { - "tmp5": GoodNOTMSONClass( - "aHello5", "aWorld5", "aPython5", **{"values": []} - ), - "tmp2": 5, - "tmp3": {"test": "test123"}, - }, - # Gotta check that if I hide an MSONable class somewhere - # it still gets correctly serialized. - {"actually_good": GoodMSONClass("1", "2", "3", **{"values": []})}, - ], - "values": [], - }, - ) - - # This will pass - test_good_class.as_dict() - - # This will fail - with pytest.raises(TypeError): - test_good_class.to_json() - - # This should also pass though - target = tmp_path / "test_dir123" - test_good_class.save(target, json_kwargs={"indent": 4, "sort_keys": True}) - - # This will fail - with pytest.raises(FileExistsError): - test_good_class.save(target, strict=True) - - # Now check that reloading this, the classes are equal! - test_good_class2 = GoodMSONClass.load(target) - - assert test_good_class == test_good_class2 + # def test_save_load(self, tmp_path): + # """Tests the save and load serialization methods.""" + # + # test_good_class = GoodMSONClass( + # "Hello", + # "World", + # "Python", + # **{ + # "cant_serialize_me": GoodNOTMSONClass( + # "Hello2", "World2", "Python2", **{"values": []} + # ), + # "cant_serialize_me2": [ + # GoodNOTMSONClass("Hello4", "World4", "Python4", **{"values": []}), + # GoodNOTMSONClass("Hello4", "World4", "Python4", **{"values": []}), + # ], + # "cant_serialize_me3": [ + # { + # "tmp": GoodMSONClass( + # "Hello5", "World5", "Python5", **{"values": []} + # ), + # "tmp2": 2, + # "tmp3": [1, 2, 3], + # }, + # { + # "tmp5": GoodNOTMSONClass( + # "aHello5", "aWorld5", "aPython5", **{"values": []} + # ), + # "tmp2": 5, + # "tmp3": {"test": "test123"}, + # }, + # # Gotta check that if I hide an MSONable class somewhere + # # it still gets correctly serialized. + # {"actually_good": GoodMSONClass("1", "2", "3", **{"values": []})}, + # ], + # "values": [], + # }, + # ) + # + # # This will pass + # test_good_class.as_dict() + # + # # This will fail + # with pytest.raises(TypeError): + # test_good_class.to_json() + # + # # This should also pass though + # target = tmp_path / "test_dir123" + # test_good_class.save(target, json_kwargs={"indent": 4, "sort_keys": True}) + # + # # This will fail + # with pytest.raises(FileExistsError): + # test_good_class.save(target, strict=True) + # + # # Now check that reloading this, the classes are equal! + # test_good_class2 = GoodMSONClass.load(target) + # + # assert test_good_class == test_good_class2 class TestJson: