Skip to content
Prev Previous commit
Next Next commit
Use assertRaisesRegex in the test_single_value_unsupported_type test
  • Loading branch information
tzabal committed Apr 26, 2020
commit bbe16bd8f5f3fa27fe3a9d7957ad449daa004fd5
2 changes: 1 addition & 1 deletion Lib/test/test_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ def test_negative_error(self):
self.assertRaises(exc, self.func, values)

def test_single_value_unsupported_type(self):
with self.assertRaises(TypeError):
with self.assertRaisesRegex(TypeError, '^unsupported type$'):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the value of this regex here: Would it be wrong if we changed the error message in the future? I prefer that we just check that a TypeError is raised.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

self.func(['3.14'])

def test_ints(self):
Expand Down