-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The binascii module is implemented completely with: * Modifications for missing yield statement * Modifications to remove dependance on KeyError The struct module misses pack_into and unpack_from (dependency on buffer type) The base64 modules misses encode and decode (dependency on file operations) git-svn-id: https://pyjamas.svn.sourceforge.net/svnroot/pyjamas/trunk@1069 7a2bd370-bda8-463c-979e-2900ccfb811e
- Loading branch information
keesbos
committed
Aug 4, 2009
1 parent
9905688
commit c0692e4
Showing
7 changed files
with
1,582 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Testing time module | ||
|
||
import sys | ||
import UnitTest | ||
import base64 | ||
|
||
|
||
class Base64ModuleTest(UnitTest.UnitTest): | ||
|
||
def testBase64(self): | ||
text = "Pyjamas is fun" | ||
|
||
encodetext = base64.encodestring(text) | ||
self.assertEqual(encodetext, 'UHlqYW1hcyBpcyBmdW4=\n') | ||
decodetext = base64.decodestring(encodetext) | ||
self.assertEqual(decodetext, text) | ||
|
||
encodetext = base64.b64encode(text) | ||
self.assertEqual(encodetext, 'UHlqYW1hcyBpcyBmdW4=') | ||
decodetext = base64.b64decode(encodetext) | ||
self.assertEqual(decodetext, text) | ||
|
||
encodetext = base64.standard_b64encode(text) | ||
self.assertEqual(encodetext, 'UHlqYW1hcyBpcyBmdW4=') | ||
decodetext = base64.standard_b64decode(encodetext) | ||
self.assertEqual(decodetext, text) | ||
|
||
encodetext = base64.urlsafe_b64encode(text) | ||
self.assertEqual(encodetext, 'UHlqYW1hcyBpcyBmdW4=') | ||
decodetext = base64.urlsafe_b64decode(encodetext) | ||
self.assertEqual(decodetext, text) | ||
|
||
def testBase32(self): | ||
text = "Pyjamas is fun" | ||
|
||
encodetext = base64.b32encode(text) | ||
self.assertEqual(encodetext, 'KB4WUYLNMFZSA2LTEBTHK3Q=') | ||
decodetext = base64.b32decode(encodetext) | ||
self.assertEqual(decodetext, text) | ||
|
||
def testBase16(self): | ||
text = "Pyjamas is fun" | ||
|
||
encodetext = base64.b16encode(text) | ||
self.assertEqual(encodetext, '50796A616D61732069732066756E') | ||
decodetext = base64.b16decode(encodetext) | ||
self.assertEqual(decodetext, text) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.