MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / test_json

Function test_json

python/test/test_usability.py:41–52  ·  view source on GitHub ↗

We can return jsoncpp objects to a native python dict.

()

Source from the content-addressed store, hash-verified

39
40
41def 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

Callers

nothing calls this directly

Calls 6

addObjectMethod · 0.95
IdfFileMethod · 0.80
IdfObjectMethod · 0.80
setNameMethod · 0.45
setDoubleMethod · 0.45
toJSONMethod · 0.45

Tested by

no test coverage detected