We can return jsoncpp objects to a native python dict.
()
| 39 | |
| 40 | |
| 41 | def test_json(): |
| 42 | """We can return jsoncpp objects to a native python dict.""" |
| 43 | idfFile = openstudio.IdfFile(openstudio.IddFileType("EnergyPlus")) |
| 44 | building = openstudio.IdfObject(openstudio.IddObjectType("Building")) |
| 45 | building.setName("Building 1") |
| 46 | building.setDouble(1, 0.0) # North Axis |
| 47 | idfFile.addObject(building) |
| 48 | d = openstudio.epjson.toJSON(idfFile) |
| 49 | assert isinstance(d, dict) |
| 50 | assert "Version" in d |
| 51 | assert "Building" in d |
| 52 | assert d["Building"]["Building 1"]["north_axis"] == 0 |