Python3 compatibility fix in commandline_count.
authorDaniil Baturin <redacted>
Thu, 10 Jul 2014 18:36:53 +0000 (01:36 +0700)
committerDaniil Baturin <redacted>
Thu, 10 Jul 2014 18:36:53 +0000 (01:36 +0700)
.count() doesn't work with strings in it, likely because strings
are unicode by default. Explicit b"" byte string argument works.

tests/xkcdp_tests.py

index 4a4cdce79eef1ff7ca92632f6a354513b458e5f9..1cc67a07a9740d34a80bc4ffd27d26797b5ad7fe 100644 (file)
@@ -34,7 +34,7 @@ class XkcdPasswordTests(unittest.TestCase):
         result = subprocess.check_output(
             ["python", "xkcdpass/xkcd_password.py", "-w", WORDFILE,
              "-c", str(count)])
-        self.assertTrue(result.count("\n"), count)
+        self.assertTrue(result.count(b"\n"), count)
 
     def test_delim(self):
         tdelim = "_"
git clone https://git.99rst.org/PROJECT