diff options
author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2018-07-09 15:25:55 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-07-09 15:25:55 (GMT) |
commit | b796e7dcdc24ff7ec53044af041254c83a8ace21 (patch) | |
tree | e2addc7ce512047e9ce01054e0587951acc8802a /Lib/test/test_warnings | |
parent | c287545d62edf1a1ee65727d3c57befa8c99c13a (diff) | |
download | cpython-b796e7dcdc24ff7ec53044af041254c83a8ace21.zip cpython-b796e7dcdc24ff7ec53044af041254c83a8ace21.tar.gz cpython-b796e7dcdc24ff7ec53044af041254c83a8ace21.tar.bz2 |
Fixed several assertTrue() that were intended to be assertEqual(). (GH-8191)
Fixed also testing the "always" warning filter.
Diffstat (limited to 'Lib/test/test_warnings')
-rw-r--r-- | Lib/test/test_warnings/__init__.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py index 87f929f..a4775d0 100644 --- a/Lib/test/test_warnings/__init__.py +++ b/Lib/test/test_warnings/__init__.py @@ -148,10 +148,14 @@ class FilterTests(BaseTest): self.module.resetwarnings() self.module.filterwarnings("always", category=UserWarning) message = "FilterTests.test_always" - self.module.warn(message, UserWarning) - self.assertTrue(message, w[-1].message) - self.module.warn(message, UserWarning) - self.assertTrue(w[-1].message, message) + def f(): + self.module.warn(message, UserWarning) + f() + self.assertEqual(len(w), 1) + self.assertEqual(w[-1].message.args[0], message) + f() + self.assertEqual(len(w), 2) + self.assertEqual(w[-1].message.args[0], message) def test_always_after_default(self): with original_warnings.catch_warnings(record=True, |