MCPcopy Index your code
hub / github.com/python/cpython / test_error_msg

Method test_error_msg

Lib/test/test_statistics.py:1020–1029  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1018 self.assertRaises(statistics.StatisticsError, next, it)
1019
1020 def test_error_msg(self):
1021 # Test that a given error message is used.
1022 msg = "badness #%d" % random.randint(10000, 99999)
1023 try:
1024 next(statistics._fail_neg([-1], msg))
1025 except statistics.StatisticsError as e:
1026 errmsg = e.args[0]
1027 else:
1028 self.fail("expected exception, but it didn't happen")
1029 self.assertEqual(errmsg, msg)
1030
1031
1032# === Tests for public functions ===

Callers

nothing calls this directly

Calls 3

randintMethod · 0.80
failMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected