Fix/test and missing definition (#18)
* added missing comment on setting up matplotlib * changed assertion description so that it makes sense * fig definition * new comment
This commit is contained in:
parent
331d1610dd
commit
988c0755a1
@ -20,11 +20,16 @@ def draw_cat_plot():
|
|||||||
|
|
||||||
# Group and reformat the data to split it by 'cardio'. Show the counts of each feature. You will have to rename one of the columns for the catplot to work correctly.
|
# Group and reformat the data to split it by 'cardio'. Show the counts of each feature. You will have to rename one of the columns for the catplot to work correctly.
|
||||||
df_cat = None
|
df_cat = None
|
||||||
|
|
||||||
|
|
||||||
# Draw the catplot with 'sns.catplot()'
|
# Draw the catplot with 'sns.catplot()'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Get the figure for the output
|
||||||
|
fig = None
|
||||||
|
|
||||||
|
|
||||||
# Do not modify the next two lines
|
# Do not modify the next two lines
|
||||||
fig.savefig('catplot.png')
|
fig.savefig('catplot.png')
|
||||||
return fig
|
return fig
|
||||||
|
@ -38,7 +38,7 @@ class HeatMapTestCase(unittest.TestCase):
|
|||||||
for label in self.ax.get_xticklabels():
|
for label in self.ax.get_xticklabels():
|
||||||
actual.append(label.get_text())
|
actual.append(label.get_text())
|
||||||
expected = ['id', 'age', 'sex', 'height', 'weight', 'ap_hi', 'ap_lo', 'cholesterol', 'gluc', 'smoke', 'alco', 'active', 'cardio', 'overweight']
|
expected = ['id', 'age', 'sex', 'height', 'weight', 'ap_hi', 'ap_lo', 'cholesterol', 'gluc', 'smoke', 'alco', 'active', 'cardio', 'overweight']
|
||||||
self.assertEqual(actual, expected, "Expected bar plot legend labels to be months of the year.")
|
self.assertEqual(actual, expected, "Expected heat map labels to be 'id', 'age', 'sex', 'height', 'weight', 'ap_hi', 'ap_lo', 'cholesterol', 'gluc', 'smoke', 'alco', 'active', 'cardio', 'overweight'.")
|
||||||
|
|
||||||
def test_heat_map_values(self):
|
def test_heat_map_values(self):
|
||||||
actual = [text.get_text() for text in self.ax.get_default_bbox_extra_artists() if isinstance(text, mpl.text.Text)]
|
actual = [text.get_text() for text in self.ax.get_default_bbox_extra_artists() if isinstance(text, mpl.text.Text)]
|
||||||
|
Loading…
Reference in New Issue
Block a user