def test_output_textdata_from_json(): output_json = {'status': 'ok', 'data': {'text/plain': 'some output'}} expected = Output(OutputStatus.OK, text='some output', json=None, ename=None, evalue=None, traceback=None) assert Output.from_json(output_json) == expected
def test_output_textdata_from_json(): output_json = {"status": "ok", "data": {"text/plain": "some output"}} expected = Output( OutputStatus.OK, text="some output", json=None, ename=None, evalue=None, traceback=None, ) assert Output.from_json(output_json) == expected
def test_output_jsondata_from_json(): output_json = { "status": "ok", "data": {"application/json": {"some": "data"}}, } expected = Output( OutputStatus.OK, text=None, json={"some": "data"}, ename=None, evalue=None, traceback=None, ) assert Output.from_json(output_json) == expected
def test_output_error_from_json(): output_json = { 'status': 'error', 'ename': 'SomeException', 'evalue': 'some error value', 'traceback': ['traceback line 1', 'traceback line 2'] } expected = Output(OutputStatus.ERROR, text=None, json=None, ename='SomeException', evalue='some error value', traceback=['traceback line 1', 'traceback line 2']) assert Output.from_json(output_json) == expected
def test_output_error_from_json(): output_json = { "status": "error", "ename": "SomeException", "evalue": "some error value", "traceback": ["traceback line 1", "traceback line 2"], } expected = Output( OutputStatus.ERROR, text=None, json=None, ename="SomeException", evalue="some error value", traceback=["traceback line 1", "traceback line 2"], ) assert Output.from_json(output_json) == expected
def test_output_jsondata_from_json(): output_json = { 'status': 'ok', 'data': { 'application/json': { 'some': 'data' } } } expected = Output(OutputStatus.OK, text=None, json={'some': 'data'}, ename=None, evalue=None, traceback=None) assert Output.from_json(output_json) == expected