]> granicus.if.org Git - python/commitdiff
Issue #14700: merge tests from 3.2.
authorMark Dickinson <mdickinson@enthought.com>
Sun, 28 Oct 2012 10:22:22 +0000 (10:22 +0000)
committerMark Dickinson <mdickinson@enthought.com>
Sun, 28 Oct 2012 10:22:22 +0000 (10:22 +0000)
1  2 
Lib/test/test_unicode.py

index b13a90a823102645b7b713a3658f9c52119c5e18,000ae6a430408757d53fa47e8ae7f6803883ae91..46c98bd9f7a8f31f19a738fc8d35469701d51eab
@@@ -1065,10 -1005,18 +1080,22 @@@ class UnicodeTest(string_tests.CommonTe
          self.assertEqual('%f' % INF, 'inf')
          self.assertEqual('%F' % INF, 'INF')
  
 +        # PEP 393
 +        self.assertEqual('%.1s' % "a\xe9\u20ac", 'a')
 +        self.assertEqual('%.2s' % "a\xe9\u20ac", 'a\xe9')
 +
+     @support.cpython_only
+     def test_formatting_huge_precision(self):
+         from _testcapi import INT_MAX
+         format_string = "%.{}f".format(INT_MAX + 1)
+         with self.assertRaises(ValueError):
+             result = format_string % 2.34
+     def test_formatting_huge_width(self):
+         format_string = "%{}f".format(sys.maxsize + 1)
+         with self.assertRaises(ValueError):
+             result = format_string % 2.34
      def test_startswith_endswith_errors(self):
          for meth in ('foo'.startswith, 'foo'.endswith):
              with self.assertRaises(TypeError) as cm: