Skip to content

Commit

Permalink
re-enable tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ardunn committed Jul 21, 2021
1 parent ed3ebda commit 861c2c4
Showing 1 changed file with 57 additions and 57 deletions.
114 changes: 57 additions & 57 deletions figrecipes/tests/test_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,63 +153,63 @@ def test_xy(self):
xy_colors_true = self.fopen("template_xy_colors.json")
self.assertTrue(xy_colors_test == xy_colors_true)

# def test_heatmap_basic(self):
# hmb_test = self.pf.heatmap_basic([a, b, c], xlabels, ylabels, return_plot=True)
# hmb_test["data"] = [p.to_plotly_json() for p in hmb_test["data"]]
# hmb_true = self.fopen("template_hmb.json")
# self.assertEqual(hmb_test, hmb_true)
#
# def test_histogram(self):
# his_test = self.pf.histogram(a + b + c, n_bins=5, return_plot=True)
# his_test["data"] = [p.to_plotly_json() for p in his_test["data"]]
# his_true = self.fopen("template_his.json")
# self.assertTrue(his_test == his_true)
#
# def test_bar(self):
# bar_test = self.pf.bar(x=a, y=b, labels=xlabels, return_plot=True)
# bar_test["data"] = [p.to_plotly_json() for p in bar_test["data"]]
# bar_true = self.fopen("template_bar.json")
# self.assertTrue(bar_test == bar_true)
#
# def test_parallel_coordinates(self):
# pcp_test = self.pf.parallel_coordinates([a, b], cols=xlabels, return_plot=True)
# pcp_test["data"] = [p.to_plotly_json() for p in pcp_test["data"]]
# pcp_true = self.fopen("template_pcp.json")
# self.assertTrue(pcp_test == pcp_true)
#
# def test_violin(self):
# vio_test = self.pf.violin([a, b, c, b, a, c, b], cols=xlabels, return_plot=True)["layout"]
# vio_test = vio_test.to_plotly_json()
# vio_true = self.fopen("template_vio.json")
#
# # Avoid errors from CircleCI's different plotly config
# for vio in [vio_test, vio_true]:
# vio["xaxis"]["range"] = [-0.167009, 0.167009]
# self.assertDictEqual(vio_test, vio_true)
#
# def test_scatter_matrix(self):
# scm_test = self.pf.scatter_matrix([a, b, c], return_plot=True)["layout"]
# scm_test = scm_test.to_plotly_json()
# scm_true = self.fopen("template_scm.json")
# self.assertTrue(scm_test == scm_true)
#
# def test_heatmap_df(self):
#
# df = pd.DataFrame(data=np.asarray([ah, bh, ch]).T, columns=["ah", "bh", "ch"])
# x_labels = ["low", "high"]
# y_labels = ["small", "large"]
# with self.assertWarns(UserWarning):
# hmdf_test = self.pf.heatmap_df(df, x_labels=x_labels, y_labels=y_labels, return_plot=True)
# hmdf_true = self.fopen("template_hmdf.json")
# self.assertTrue(hmdf_test, hmdf_true)
#
# def test_triangle(self):
# df = pd.DataFrame(np.random.rand(50, 3), columns=list("qwe"))
# triangle_test = self.pf.triangle(df[["q", "w", "e"]], return_plot=True)
# triangle_true = self.fopen("template_triangle.json")
# self.assertTrue(triangle_test, triangle_true)
def test_heatmap_basic(self):
hmb_test = self.pf.heatmap_basic([a, b, c], xlabels, ylabels, return_plot=True)
hmb_test["data"] = [p.to_plotly_json() for p in hmb_test["data"]]
hmb_true = self.fopen("template_hmb.json")
self.assertEqual(hmb_test, hmb_true)

def test_histogram(self):
his_test = self.pf.histogram(a + b + c, n_bins=5, return_plot=True)
his_test["data"] = [p.to_plotly_json() for p in his_test["data"]]
his_true = self.fopen("template_his.json")
self.assertTrue(his_test == his_true)

def test_bar(self):
bar_test = self.pf.bar(x=a, y=b, labels=xlabels, return_plot=True)
bar_test["data"] = [p.to_plotly_json() for p in bar_test["data"]]
bar_true = self.fopen("template_bar.json")
self.assertTrue(bar_test == bar_true)

def test_parallel_coordinates(self):
pcp_test = self.pf.parallel_coordinates([a, b], cols=xlabels, return_plot=True)
pcp_test["data"] = [p.to_plotly_json() for p in pcp_test["data"]]
pcp_true = self.fopen("template_pcp.json")
self.assertTrue(pcp_test == pcp_true)

def test_violin(self):
vio_test = self.pf.violin([a, b, c, b, a, c, b], cols=xlabels, return_plot=True)["layout"]
vio_test = vio_test.to_plotly_json()
vio_true = self.fopen("template_vio.json")

# Avoid errors from CircleCI's different plotly config
for vio in [vio_test, vio_true]:
vio["xaxis"]["range"] = [-0.167009, 0.167009]
self.assertDictEqual(vio_test, vio_true)

def test_scatter_matrix(self):
scm_test = self.pf.scatter_matrix([a, b, c], return_plot=True)["layout"]
scm_test = scm_test.to_plotly_json()
scm_true = self.fopen("template_scm.json")
self.assertTrue(scm_test == scm_true)

def test_heatmap_df(self):

df = pd.DataFrame(data=np.asarray([ah, bh, ch]).T, columns=["ah", "bh", "ch"])
x_labels = ["low", "high"]
y_labels = ["small", "large"]
with self.assertWarns(UserWarning):
hmdf_test = self.pf.heatmap_df(df, x_labels=x_labels, y_labels=y_labels, return_plot=True)
hmdf_true = self.fopen("template_hmdf.json")
self.assertTrue(hmdf_test, hmdf_true)

def test_triangle(self):
df = pd.DataFrame(np.random.rand(50, 3), columns=list("qwe"))
triangle_test = self.pf.triangle(df[["q", "w", "e"]], return_plot=True)
triangle_true = self.fopen("template_triangle.json")
self.assertTrue(triangle_test, triangle_true)


if __name__ == "__main__":
refresh_json(open_plots=True)
# unittest.main()
# refresh_json(open_plots=True)
unittest.main()

0 comments on commit 861c2c4

Please sign in to comment.