Data Analysis with Python Projects - Medical Data Visualizer

I think there is a problem with the Test for this assignment :

Data Analysis with Python Projects - Medical Data Visualizer

The heatmap is generated correctly according to the given picture, but test fails ,saying there are some difference between actual vs expected. The test code contains empty values in the last 3 elements of the expected array.

Please give it a look, there might be problem with the test case for the project.

please provide the code responsible for the behaviour, for example, please provide your repl link

The original test code was :

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)]
print(actual)
expected = [‘0.0’, ‘0.0’, ‘-0.0’, ‘0.0’, ‘-0.1’, ‘0.5’, ‘0.0’, ‘0.1’, ‘0.1’, ‘0.3’, ‘0.0’, ‘0.0’, ‘0.0’, ‘0.0’, ‘0.0’, ‘0.0’, ‘0.2’, ‘0.1’, ‘0.0’, ‘0.2’, ‘0.1’, ‘0.0’, ‘0.1’, ‘-0.0’, ‘-0.1’, ‘0.1’, ‘0.0’, ‘0.2’, ‘0.0’, ‘0.1’, ‘-0.0’, ‘-0.0’, ‘0.1’, ‘0.0’, ‘0.1’, ‘0.4’, ‘-0.0’, ‘-0.0’, ‘0.3’, ‘0.2’, ‘0.1’, ‘-0.0’, ‘0.0’, ‘0.0’, ‘-0.0’, ‘-0.0’, ‘-0.0’, ‘0.2’, ‘0.1’, ‘0.1’, ‘0.0’, ‘0.0’, ‘0.0’, ‘0.0’, ‘0.3’, ‘0.0’, ‘-0.0’, ‘0.0’, ‘-0.0’, ‘-0.0’, ‘-0.0’, ‘0.0’, ‘0.0’, ‘-0.0’, ‘0.0’, ‘0.0’, ‘0.0’, ‘0.2’, ‘0.0’, ‘-0.0’, ‘0.2’, ‘0.1’, ‘0.3’, ‘0.2’, ‘0.1’, ‘-0.0’, ‘-0.0’, ‘-0.0’, ‘-0.0’, ‘0.1’, ‘-0.1’, ‘-0.1’, ‘0.7’, ‘0.0’, ‘0.2’, ‘0.1’, ‘0.1’, ‘-0.0’, ‘0.0’, ‘-0.0’, ‘0.1’, ‘’, ‘’, ‘’]
self.assertEqual(actual, expected, “Expected differnt values in heat map.”)

@ilenia Any idea what is happening ?

Change the matplotlib version to “3.1.2” in the poetry file. You are probably using a newer version.

hi,
I came across the same issue. As per my findings, we need to specify the fmt parameter within last heatmap to ‘0.1f’. it brings 1 decimal precision when some labels are text.
I think you have sorted this issue by yourself already. Just shared my views as we shared the same problem. cheers. :slightly_smiling_face: