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.
pywikibot hasunit test modules that use assertRaises and probably need upgrading: