Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(85171)

Unified Diff: Lib/test/test_binascii.py

Issue 25357: Add an optional newline parameter to binascii.b2a_base64() to not add a newline
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
--- a/Lib/test/test_binascii.py Fri Oct 09 13:10:05 2015 +0200
+++ b/Lib/test/test_binascii.py Fri Oct 09 19:05:11 2015 +0200
@@ -262,6 +262,16 @@ class BinASCIITest(unittest.TestCase):
# non-ASCII string
self.assertRaises(ValueError, a2b, "\x80")
+ def test_b2a_base64_newline(self):
+ # Issue #25357: test newline parameter
+ b = self.type2test(b'hello')
+ self.assertEqual(binascii.b2a_base64(b),
+ b'aGVsbG8=\n')
+ self.assertEqual(binascii.b2a_base64(b, newline=True),
+ b'aGVsbG8=\n')
+ self.assertEqual(binascii.b2a_base64(b, newline=False),
+ b'aGVsbG8=')
+
class ArrayBinASCIITest(BinASCIITest):
def type2test(self, s):

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+