def test_init_empty(self): model = Temperature() py_json = model.py_json() # should only have a unit_type assert py_json == {} # non-sparse should have all attributes present with None values py_json = model.py_json(sparse=False) assert py_json['unit_type'] == 'temperature' for attr in ('value', 'unit', 'min_value', 'max_value', 'standard_deviation', 'replicates'): assert py_json[attr] is None
def test_py_json(self): model = Temperature(value=273.15, unit="K", standard_deviation=1.2, replicates=3) py_json = model.py_json() print(py_json) assert len(py_json) == 5 assert py_json['value'] == 273.15 assert py_json['unit'] == 'K' assert py_json['unit_type'] == 'temperature' assert py_json['standard_deviation'] == 1.2 assert py_json['replicates'] == 3