summaryrefslogtreecommitdiff
path: root/bs4/tests/test_builder_registry.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2014-12-07 09:31:30 -0500
committerLeonard Richardson <leonardr@segfault.org>2014-12-07 09:31:30 -0500
commitbf58c02abf418556927363cf79cc86bee58d0592 (patch)
tree747e9f5a6d6aa7fcce064ad44c9efb5e43fdca73 /bs4/tests/test_builder_registry.py
parenta7f63d509473e11a48ff3f9b2d8b37a19a7a25ef (diff)
Issue a warning if the BeautifulSoup constructor arguments do not explicitly name a parser.
Diffstat (limited to 'bs4/tests/test_builder_registry.py')
-rw-r--r--bs4/tests/test_builder_registry.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/bs4/tests/test_builder_registry.py b/bs4/tests/test_builder_registry.py
index 92ad10f..90cad82 100644
--- a/bs4/tests/test_builder_registry.py
+++ b/bs4/tests/test_builder_registry.py
@@ -1,6 +1,7 @@
"""Tests of the builder registry."""
import unittest
+import warnings
from bs4 import BeautifulSoup
from bs4.builder import (
@@ -67,10 +68,15 @@ class BuiltInRegistryTest(unittest.TestCase):
HTMLParserTreeBuilder)
def test_beautifulsoup_constructor_does_lookup(self):
- # You can pass in a string.
- BeautifulSoup("", features="html")
- # Or a list of strings.
- BeautifulSoup("", features=["html", "fast"])
+
+ with warnings.catch_warnings(record=True) as w:
+ # This will create a warning about not explicitly
+ # specifying a parser, but we'll ignore it.
+
+ # You can pass in a string.
+ BeautifulSoup("", features="html")
+ # Or a list of strings.
+ BeautifulSoup("", features=["html", "fast"])
# You'll get an exception if BS can't find an appropriate
# builder.