diff options
author | Leonard Richardson <leonardr@segfault.org> | 2023-01-27 20:06:49 -0500 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2023-01-27 20:06:49 -0500 |
commit | 5d4b8486b096aae9605d29774038107f01ecad65 (patch) | |
tree | a1e0ad353f9817689db347a48cd0c250a44a06d9 /bs4/tests/test_tree.py | |
parent | 770030fccfd374e5d12f257e9be30b23ddc844a5 (diff) |
Check the associated filename for more warnings.
Diffstat (limited to 'bs4/tests/test_tree.py')
-rw-r--r-- | bs4/tests/test_tree.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bs4/tests/test_tree.py b/bs4/tests/test_tree.py index e456966..0c49cb4 100644 --- a/bs4/tests/test_tree.py +++ b/bs4/tests/test_tree.py @@ -1282,13 +1282,17 @@ class TestDeprecatedArguments(SoupTest): [result] = soup.find_all(text='markup') assert result == 'markup' assert result.parent.name == 'b' - msg = str(w[0].message) + [warning] = w + assert warning.filename == __file__ + msg = str(warning.message) assert msg == "The 'text' argument to find()-type methods is deprecated. Use 'string' instead." def test_soupstrainer_constructor_string(self): with warnings.catch_warnings(record=True) as w: strainer = SoupStrainer(text="text") assert strainer.text == 'text' - msg = str(w[0].message) + [warning] = w + msg = str(warning.message) + assert warning.filename == __file__ assert msg == "The 'text' argument to the SoupStrainer constructor is deprecated. Use 'string' instead." |