def test_to_and_from_dict(): sky = CIE(38.186734, 270.410387) sky_from_dict = CIE.from_dict(sky.to_dict()) assert sky == sky_from_dict
def test_dict_to_object_cie_sky(): """Test the dict_to_object method with Sky objects.""" sky_obj = CIE(38.186734, 270.410387) sky_dict = sky_obj.to_dict() new_sky = dict_to_object(sky_dict) assert isinstance(new_sky, CIE)
def sky_cie(directory): sky = CIE(38.186734, 270.410387) dest_file = os.path.join(directory, 'sky_cie.json') with open(dest_file, 'w') as fp: json.dump(sky.to_dict(), fp, indent=4)