summaryrefslogtreecommitdiff
path: root/bs4/tests/test_soup.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2019-07-16 15:35:18 -0400
committerLeonard Richardson <leonardr@segfault.org>2019-07-16 15:35:18 -0400
commit0bd336741b26269108e8b345b92d8904c6092980 (patch)
treef8383b029b56529380df24481d52d00300677f93 /bs4/tests/test_soup.py
parent7086ef1c7c3d48f5bdeb7bdef142a878c802dc5f (diff)
Suppressed warnings during tests that aren't about the warnings.
Diffstat (limited to 'bs4/tests/test_soup.py')
-rw-r--r--bs4/tests/test_soup.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/bs4/tests/test_soup.py b/bs4/tests/test_soup.py
index e50d603..dc85bb6 100644
--- a/bs4/tests/test_soup.py
+++ b/bs4/tests/test_soup.py
@@ -73,7 +73,8 @@ class TestConstructor(SoupTest):
# will be stripped out.
convertEntities=True,
)
- soup = BeautifulSoup('', builder=Mock, **kwargs)
+ with warnings.catch_warnings(record=True):
+ soup = BeautifulSoup('', builder=Mock, **kwargs)
assert isinstance(soup.builder, Mock)
self.assertEqual(dict(var="value"), soup.builder.called_with)
@@ -111,7 +112,10 @@ class TestConstructor(SoupTest):
# Here are two ways of saying that `id` is a multi-valued
# attribute in this context, but 'class' is not.
for switcheroo in ({'*': 'id'}, {'a': 'id'}):
- soup = self.soup(markup, builder=None, multi_valued_attributes=switcheroo)
+ with warnings.catch_warnings(record=True) as w:
+ # This will create a warning about not explicitly
+ # specifying a parser, but we'll ignore it.
+ soup = self.soup(markup, builder=None, multi_valued_attributes=switcheroo)
a = soup.a
self.assertEqual(["an", "id"], a['id'])
self.assertEqual(" a class ", a['class'])