]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_quopri.py
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Lib / test / test_quopri.py
diff --git a/AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_quopri.py b/AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_quopri.py
deleted file mode 100644 (file)
index fb580eb..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-from test import test_support\r
-import unittest\r
-\r
-import sys, cStringIO, subprocess\r
-import quopri\r
-\r
-\r
-\r
-ENCSAMPLE = """\\r
-Here's a bunch of special=20\r
-\r
-=A1=A2=A3=A4=A5=A6=A7=A8=A9\r
-=AA=AB=AC=AD=AE=AF=B0=B1=B2=B3\r
-=B4=B5=B6=B7=B8=B9=BA=BB=BC=BD=BE\r
-=BF=C0=C1=C2=C3=C4=C5=C6\r
-=C7=C8=C9=CA=CB=CC=CD=CE=CF\r
-=D0=D1=D2=D3=D4=D5=D6=D7\r
-=D8=D9=DA=DB=DC=DD=DE=DF\r
-=E0=E1=E2=E3=E4=E5=E6=E7\r
-=E8=E9=EA=EB=EC=ED=EE=EF\r
-=F0=F1=F2=F3=F4=F5=F6=F7\r
-=F8=F9=FA=FB=FC=FD=FE=FF\r
-\r
-characters... have fun!\r
-"""\r
-\r
-# First line ends with a space\r
-DECSAMPLE = "Here's a bunch of special \n" + \\r
-"""\\r
-\r
-\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\r
-\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\r
-\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\r
-\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\r
-\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\r
-\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\r
-\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\r
-\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\r
-\xe8\xe9\xea\xeb\xec\xed\xee\xef\r
-\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\r
-\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff\r
-\r
-characters... have fun!\r
-"""\r
-\r
-\r
-def withpythonimplementation(testfunc):\r
-    def newtest(self):\r
-        # Test default implementation\r
-        testfunc(self)\r
-        # Test Python implementation\r
-        if quopri.b2a_qp is not None or quopri.a2b_qp is not None:\r
-            oldencode = quopri.b2a_qp\r
-            olddecode = quopri.a2b_qp\r
-            try:\r
-                quopri.b2a_qp = None\r
-                quopri.a2b_qp = None\r
-                testfunc(self)\r
-            finally:\r
-                quopri.b2a_qp = oldencode\r
-                quopri.a2b_qp = olddecode\r
-    newtest.__name__ = testfunc.__name__\r
-    return newtest\r
-\r
-class QuopriTestCase(unittest.TestCase):\r
-    # Each entry is a tuple of (plaintext, encoded string).  These strings are\r
-    # used in the "quotetabs=0" tests.\r
-    STRINGS = (\r
-        # Some normal strings\r
-        ('hello', 'hello'),\r
-        ('''hello\r
-        there\r
-        world''', '''hello\r
-        there\r
-        world'''),\r
-        ('''hello\r
-        there\r
-        world\r
-''', '''hello\r
-        there\r
-        world\r
-'''),\r
-        ('\201\202\203', '=81=82=83'),\r
-        # Add some trailing MUST QUOTE strings\r
-        ('hello ', 'hello=20'),\r
-        ('hello\t', 'hello=09'),\r
-        # Some long lines.  First, a single line of 108 characters\r
-        ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\r
-         '''xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=D8=D9=DA=DB=DC=DD=DE=DFx=\r
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'''),\r
-        # A line of exactly 76 characters, no soft line break should be needed\r
-        ('yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',\r
-        'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'),\r
-        # A line of 77 characters, forcing a soft line break at position 75,\r
-        # and a second line of exactly 2 characters (because the soft line\r
-        # break `=' sign counts against the line length limit).\r
-        ('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz',\r
-         '''zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz=\r
-zz'''),\r
-        # A line of 151 characters, forcing a soft line break at position 75,\r
-        # with a second line of exactly 76 characters and no trailing =\r
-        ('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz',\r
-         '''zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz=\r
-zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'''),\r
-        # A string containing a hard line break, but which the first line is\r
-        # 151 characters and the second line is exactly 76 characters.  This\r
-        # should leave us with three lines, the first which has a soft line\r
-        # break, and which the second and third do not.\r
-        ('''yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\r
-zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz''',\r
-         '''yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy=\r
-yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\r
-zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'''),\r
-        # Now some really complex stuff ;)\r
-        (DECSAMPLE, ENCSAMPLE),\r
-        )\r
-\r
-    # These are used in the "quotetabs=1" tests.\r
-    ESTRINGS = (\r
-        ('hello world', 'hello=20world'),\r
-        ('hello\tworld', 'hello=09world'),\r
-        )\r
-\r
-    # These are used in the "header=1" tests.\r
-    HSTRINGS = (\r
-        ('hello world', 'hello_world'),\r
-        ('hello_world', 'hello=5Fworld'),\r
-        )\r
-\r
-    @withpythonimplementation\r
-    def test_encodestring(self):\r
-        for p, e in self.STRINGS:\r
-            self.assertTrue(quopri.encodestring(p) == e)\r
-\r
-    @withpythonimplementation\r
-    def test_decodestring(self):\r
-        for p, e in self.STRINGS:\r
-            self.assertTrue(quopri.decodestring(e) == p)\r
-\r
-    @withpythonimplementation\r
-    def test_idempotent_string(self):\r
-        for p, e in self.STRINGS:\r
-            self.assertTrue(quopri.decodestring(quopri.encodestring(e)) == e)\r
-\r
-    @withpythonimplementation\r
-    def test_encode(self):\r
-        for p, e in self.STRINGS:\r
-            infp = cStringIO.StringIO(p)\r
-            outfp = cStringIO.StringIO()\r
-            quopri.encode(infp, outfp, quotetabs=False)\r
-            self.assertTrue(outfp.getvalue() == e)\r
-\r
-    @withpythonimplementation\r
-    def test_decode(self):\r
-        for p, e in self.STRINGS:\r
-            infp = cStringIO.StringIO(e)\r
-            outfp = cStringIO.StringIO()\r
-            quopri.decode(infp, outfp)\r
-            self.assertTrue(outfp.getvalue() == p)\r
-\r
-    @withpythonimplementation\r
-    def test_embedded_ws(self):\r
-        for p, e in self.ESTRINGS:\r
-            self.assertTrue(quopri.encodestring(p, quotetabs=True) == e)\r
-            self.assertTrue(quopri.decodestring(e) == p)\r
-\r
-    @withpythonimplementation\r
-    def test_encode_header(self):\r
-        for p, e in self.HSTRINGS:\r
-            self.assertTrue(quopri.encodestring(p, header=True) == e)\r
-\r
-    @withpythonimplementation\r
-    def test_decode_header(self):\r
-        for p, e in self.HSTRINGS:\r
-            self.assertTrue(quopri.decodestring(e, header=True) == p)\r
-\r
-    def test_scriptencode(self):\r
-        (p, e) = self.STRINGS[-1]\r
-        process = subprocess.Popen([sys.executable, "-mquopri"],\r
-                                   stdin=subprocess.PIPE, stdout=subprocess.PIPE)\r
-        self.addCleanup(process.stdout.close)\r
-        cout, cerr = process.communicate(p)\r
-        # On Windows, Python will output the result to stdout using\r
-        # CRLF, as the mode of stdout is text mode. To compare this\r
-        # with the expected result, we need to do a line-by-line comparison.\r
-        self.assertEqual(cout.splitlines(), e.splitlines())\r
-\r
-    def test_scriptdecode(self):\r
-        (p, e) = self.STRINGS[-1]\r
-        process = subprocess.Popen([sys.executable, "-mquopri", "-d"],\r
-                                   stdin=subprocess.PIPE, stdout=subprocess.PIPE)\r
-        self.addCleanup(process.stdout.close)\r
-        cout, cerr = process.communicate(e)\r
-        self.assertEqual(cout.splitlines(), p.splitlines())\r
-\r
-def test_main():\r
-    test_support.run_unittest(QuopriTestCase)\r
-\r
-\r
-if __name__ == "__main__":\r
-    test_main()\r