]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_fpformat.py
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Lib / test / test_fpformat.py
diff --git a/AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_fpformat.py b/AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_fpformat.py
deleted file mode 100644 (file)
index 9f6b156..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-'''\r
-   Tests for fpformat module\r
-   Nick Mathewson\r
-'''\r
-from test.test_support import run_unittest, import_module\r
-import unittest\r
-fpformat = import_module('fpformat', deprecated=True)\r
-fix, sci, NotANumber = fpformat.fix, fpformat.sci, fpformat.NotANumber\r
-\r
-StringType = type('')\r
-\r
-# Test the old and obsolescent fpformat module.\r
-#\r
-# (It's obsolescent because fix(n,d) == "%.*f"%(d,n) and\r
-#                           sci(n,d) == "%.*e"%(d,n)\r
-#  for all reasonable numeric n and d, except that sci gives 3 exponent\r
-#  digits instead of 2.\r
-#\r
-# Differences only occur for unreasonable n and d.    <.2 wink>)\r
-\r
-class FpformatTest(unittest.TestCase):\r
-\r
-    def checkFix(self, n, digits):\r
-        result = fix(n, digits)\r
-        if isinstance(n, StringType):\r
-            n = repr(n)\r
-        expected = "%.*f" % (digits, float(n))\r
-\r
-        self.assertEqual(result, expected)\r
-\r
-    def checkSci(self, n, digits):\r
-        result = sci(n, digits)\r
-        if isinstance(n, StringType):\r
-            n = repr(n)\r
-        expected = "%.*e" % (digits, float(n))\r
-        # add the extra 0 if needed\r
-        num, exp = expected.split("e")\r
-        if len(exp) < 4:\r
-            exp = exp[0] + "0" + exp[1:]\r
-        expected = "%se%s" % (num, exp)\r
-\r
-        self.assertEqual(result, expected)\r
-\r
-    def test_basic_cases(self):\r
-        self.assertEqual(fix(100.0/3, 3), '33.333')\r
-        self.assertEqual(sci(100.0/3, 3), '3.333e+001')\r
-\r
-    def test_reasonable_values(self):\r
-        for d in range(7):\r
-            for val in (1000.0/3, 1000, 1000.0, .002, 1.0/3, 1e10):\r
-                for realVal in (val, 1.0/val, -val, -1.0/val):\r
-                    self.checkFix(realVal, d)\r
-                    self.checkSci(realVal, d)\r
-\r
-    def test_failing_values(self):\r
-        # Now for 'unreasonable n and d'\r
-        self.assertEqual(fix(1.0, 1000), '1.'+('0'*1000))\r
-        self.assertEqual(sci("1"+('0'*1000), 0), '1e+1000')\r
-\r
-        # This behavior is inconsistent.  sci raises an exception; fix doesn't.\r
-        yacht = "Throatwobbler Mangrove"\r
-        self.assertEqual(fix(yacht, 10), yacht)\r
-        try:\r
-            sci(yacht, 10)\r
-        except NotANumber:\r
-            pass\r
-        else:\r
-            self.fail("No exception on non-numeric sci")\r
-\r
-\r
-def test_main():\r
-    run_unittest(FpformatTest)\r
-\r
-\r
-if __name__ == "__main__":\r
-    test_main()\r