unittest.assertRaises is almost always lazy, and should be avoided.
The only desirable use of unittest.assertRaises is:
with self.assertRaises(ValueError) as cm: self.assertEqual(cm.exception, '.....')
unitest.assertRaisesRegex has an extra parameter to check the exception message, and should be used instead. By checking the exception message, the unit test verifies that the exception is precisely the one which was expected, rather than only of the same type as expected.
See: https://docs.python.org/3/library/unittest.html?highlight=assertraisesregex#unittest.TestCase.assertRaisesRegex
pywikibot hasunit test modules that use assertRaises and probably need upgrading:
https://codesearch.wmcloud.org/pywikibot/?q=assertRaises%5C(&i=nope&files=&excludeFiles=&repos=