Skip to content

Commit 67dcccf

Browse files
committed
add more testcases to test warns in test_base64
for b32,b16 encode
1 parent 96168b2 commit 67dcccf

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Lib/test/test_base64.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,20 @@ def test_b64encode_warns(self):
118118
warnings.simplefilter('always', UserWarning)
119119
base64.b64encode(b'test')
120120
self.assertTrue(any('base64.b64encode returns str in Python 2 (bytes in 3.x)' == str(x.message) for x in w))
121+
122+
def test_b32encode_warns(self):
123+
import warnings, base64
124+
with warnings.catch_warnings(record=True) as w:
125+
warnings.simplefilter('always', UserWarning)
126+
base64.b32encode(b'test')
127+
self.assertTrue(any('base64.b32encode returns str in Python 2 (bytes in 3.x)' == str(x.message) for x in w))
128+
129+
def test_b16encode_warns(self):
130+
import warnings, base64
131+
with warnings.catch_warnings(record=True) as w:
132+
warnings.simplefilter('always', UserWarning)
133+
base64.b16encode(b'test')
134+
self.assertTrue(any('base64.b16encode returns str in Python 2 (bytes in 3.x)' == str(x.message) for x in w))
121135

122136
def test_b64decode(self):
123137
eq = self.assertEqual

0 commit comments

Comments
 (0)