summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.txt8
-rw-r--r--bs4/tests/test_soup.py7
-rwxr-xr-xconvert-python3.26
3 files changed, 10 insertions, 11 deletions
diff --git a/README.txt b/README.txt
index 585487e..ec9801e 100644
--- a/README.txt
+++ b/README.txt
@@ -200,14 +200,12 @@ parser, you can set it manually.
Here's how to run the tests on Python 2.7:
$ cd bs4
- $ python2.7 -m unittest discover
+ $ python2.7 -m unittest discover -s bs4
Here's how to do it with Python 3.2:
$ ./convert-python3.2
$ cd python3.2/bs4
- $ python3.2 -m unittest discover
-
-
-
+ $ python3.2 -m unittest discover -s bs4
+The script test-all-versions will run the tests twice.
diff --git a/bs4/tests/test_soup.py b/bs4/tests/test_soup.py
index b588561..f995678 100644
--- a/bs4/tests/test_soup.py
+++ b/bs4/tests/test_soup.py
@@ -15,15 +15,16 @@ class TestDeprecatedConstructorArguments(SoupTest):
msg = str(w[0].message)
self.assertTrue("parseOnlyThese" in msg)
self.assertTrue("parse_only" in msg)
- self.assertEquals("<b></b>", soup.encode())
+ self.assertEquals(b"<b></b>", soup.encode())
def test_fromEncoding_renamed_to_from_encoding(self):
with warnings.catch_warnings(record=True) as w:
- soup = self.soup("<a>", fromEncoding=("shift_jis"))
+ utf8 = b"\xc3\xa9"
+ soup = self.soup(utf8, fromEncoding="utf8")
msg = str(w[0].message)
self.assertTrue("fromEncoding" in msg)
self.assertTrue("from_encoding" in msg)
- self.assertEquals("shift_jis", soup.original_encoding)
+ self.assertEquals("utf8", soup.original_encoding)
def test_unrecognized_keyword_argument(self):
self.assertRaises(
diff --git a/convert-python3.2 b/convert-python3.2
index 7e86f35..cbd5559 100755
--- a/convert-python3.2
+++ b/convert-python3.2
@@ -4,12 +4,12 @@
# create a new python3/bs4 source tree that works under Python 3.
#
# See README.txt to see how to run the test suite after conversion.
-echo "About to destroy the python3.2/bs4 directory."
-echo "Don't let this script run any further if your own stuff is in there."
+echo "About to destroy and rebuild the python3.2/bs4 directory."
+echo "If you've got stuff in there, Ctrl-C out of this script or answer 'n'."
rm -rfI python3.2/bs4
cp -r bs4 python3.2
2to3-3.2 -w python3.2
echo ""
echo "OK, conversion is done."
echo "Now running the unit tests."
-(cd python3.2/bs4 && python3.2 -m unittest discover) \ No newline at end of file
+(cd python3.2 && python3.2 -m unittest discover -s bs4) \ No newline at end of file