mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
fix test_unittest: ignore DeprecationWarning on assertDictContainsSubset()
This commit is contained in:
parent
47f14bade8
commit
cae969e70a
2 changed files with 30 additions and 24 deletions
|
@ -1,5 +1,5 @@
|
||||||
import datetime
|
import datetime
|
||||||
|
import warnings
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
@ -224,6 +224,9 @@ class TestLongMessage(unittest.TestCase):
|
||||||
"\+ \{'key': 'value'\} : oops$"])
|
"\+ \{'key': 'value'\} : oops$"])
|
||||||
|
|
||||||
def testAssertDictContainsSubset(self):
|
def testAssertDictContainsSubset(self):
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
warnings.simplefilter("ignore", DeprecationWarning)
|
||||||
|
|
||||||
self.assertMessages('assertDictContainsSubset', ({'key': 'value'}, {}),
|
self.assertMessages('assertDictContainsSubset', ({'key': 'value'}, {}),
|
||||||
["^Missing: 'key'$", "^oops$",
|
["^Missing: 'key'$", "^oops$",
|
||||||
"^Missing: 'key'$",
|
"^Missing: 'key'$",
|
||||||
|
|
|
@ -489,6 +489,9 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
|
||||||
animals)
|
animals)
|
||||||
|
|
||||||
def testAssertDictContainsSubset(self):
|
def testAssertDictContainsSubset(self):
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
warnings.simplefilter("ignore", DeprecationWarning)
|
||||||
|
|
||||||
self.assertDictContainsSubset({}, {})
|
self.assertDictContainsSubset({}, {})
|
||||||
self.assertDictContainsSubset({}, {'a': 1})
|
self.assertDictContainsSubset({}, {'a': 1})
|
||||||
self.assertDictContainsSubset({'a': 1}, {'a': 1})
|
self.assertDictContainsSubset({'a': 1}, {'a': 1})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue