[pypy-svn] r10096 - pypy/dist/pypy/lib/test2

briandorsey at codespeak.net briandorsey at codespeak.net
Tue Mar 22 23:51:25 CET 2005


Author: briandorsey
Date: Tue Mar 22 23:51:25 2005
New Revision: 10096

Added:
   pypy/dist/pypy/lib/test2/test_binascii_extra.py
Log:
A few extra very simple tests for binascii. The std library tests only test round-triping the functions, without actually checking to see what the functions do.



Added: pypy/dist/pypy/lib/test2/test_binascii_extra.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/lib/test2/test_binascii_extra.py	Tue Mar 22 23:51:25 2005
@@ -0,0 +1,21 @@
+
+import unittest
+import binascii
+
+class TestBinAscii(unittest.TestCase):
+    def test_uu(self):
+        assert binascii.b2a_uu('1234567') == "',3(S-#4V-P  \n"
+        assert binascii.b2a_uu('123456789012345678901234567890123456789012345') == 'M,3(S-#4V-S at Y,#$R,S0U-C<X.3 Q,C,T-38W.#DP,3(S-#4V-S at Y,#$R,S0U\n'
+        try:
+            assert binascii.b2a_uu('1234567890123456789012345678901234567890123456')
+        except binascii.Error:
+            pass
+        else:
+            assert False, "Expected binascii.Error on oversize input."
+        assert binascii.b2a_uu('1234567') == "',3(S-#4V-P  \n"
+        assert binascii.b2a_uu('123456789012345678901234567890123456789012345')  == 'M,3(S-#4V-S at Y,#$R,S0U-C<X.3 Q,C,T-38W.#DP,3(S-#4V-S at Y,#$R,S0U\n'
+
+
+    def test_base64(self):
+        assert binascii.b2a_base64('xxxx') == 'eHh4eA==\n'
+



More information about the Pypy-commit mailing list