Skip to content

Commit

Permalink
Fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
hdoupe committed Jan 8, 2020
1 parent 8290d1d commit ed07fc2
Showing 1 changed file with 26 additions and 38 deletions.
64 changes: 26 additions & 38 deletions cs_storage/tests/test_cs_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
def png():
import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 2, 100)
plt.figure()
plt.plot(x, x, label='linear')
plt.plot(x, x**2, label='quadratic')
plt.plot(x, x**3, label='cubic')
plt.xlabel('x label')
plt.ylabel('y label')
plt.plot(x, x, label="linear")
plt.plot(x, x ** 2, label="quadratic")
plt.plot(x, x ** 3, label="cubic")
plt.xlabel("x label")
plt.ylabel("y label")
plt.title("Simple Plot")
plt.legend()
initial_buff = io.BytesIO()
Expand All @@ -34,13 +35,14 @@ def png():
def jpg():
import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 2, 100)
plt.figure()
plt.plot(x, x, label='linear')
plt.plot(x, x**2, label='quadratic')
plt.plot(x, x**3, label='cubic')
plt.xlabel('x label')
plt.ylabel('y label')
plt.plot(x, x, label="linear")
plt.plot(x, x ** 2, label="quadratic")
plt.plot(x, x ** 3, label="cubic")
plt.xlabel("x label")
plt.ylabel("y label")
plt.title("Simple Plot")
plt.legend()
initial_buff = io.BytesIO()
Expand Down Expand Up @@ -115,32 +117,11 @@ def test_cs_storage(png, jpg):
"title": "bokeh plot",
"data": {"html": "<div/>", "javascript": "console.log('hello world')"},
},
{
"media_type": "table",
"title": "table stuff",
"data": "<table/>",
},
{
"media_type": "PNG",
"title": "PNG data",
"data": png,
},
{
"media_type": "JPEG",
"title": "JPEG data",
"data": jpg,
},
{
"media_type": "MP3",
"title": "MP3 data",
"data": b"MP3 bytes",
},

{
"media_type": "MP4",
"title": "MP4 data",
"data": b"MP4 bytes",
},
{"media_type": "table", "title": "table stuff", "data": "<table/>"},
{"media_type": "PNG", "title": "PNG data", "data": png},
{"media_type": "JPEG", "title": "JPEG data", "data": jpg},
{"media_type": "MP3", "title": "MP3 data", "data": b"MP3 bytes"},
{"media_type": "MP4", "title": "MP4 data", "data": b"MP4 bytes"},
],
"downloadable": [
{"media_type": "CSV", "title": "CSV file", "data": "comma,sep,values\n"},
Expand All @@ -160,7 +141,7 @@ def test_cs_storage(png, jpg):
}
task_id = "1868c4a7-b03c-4fe4-ab45-0aa95c0bfa53"
rem_res = cs_storage.write(task_id, exp_loc_res)
loc_res = cs_storage.read(rem_res)
loc_res = cs_storage.read(rem_res, json_serializable=False)
for output_type in ["renderable", "downloadable"]:
loc_res_without_id = [
{k: v for k, v in output.items() if k != "id"}
Expand All @@ -172,7 +153,11 @@ def test_cs_storage(png, jpg):
]
assert exp_res_without_id == loc_res_without_id

loc_res1 = cs_storage.read({"renderable": rem_res["renderable"]})
assert json.dumps(cs_storage.read(rem_res, json_serializable=True))

loc_res1 = cs_storage.read(
{"renderable": rem_res["renderable"]}, json_serializable=False
)
loc_res_without_id = [
{k: v for k, v in output.items() if k != "id"}
for output in loc_res1["renderable"]
Expand All @@ -183,6 +168,9 @@ def test_cs_storage(png, jpg):
]

assert exp_res_without_id == loc_res_without_id
assert json.dumps(
cs_storage.read({"renderable": rem_res["renderable"]}, json_serializable=True)
)


def test_add_screenshot_links():
Expand Down

0 comments on commit ed07fc2

Please sign in to comment.