Commits

strontium committed 39be778

Clear all relevent warnings from test suite run with python -3
Add tests and errors for running scripts under python 3.

Comments (0)

Files changed (8)

babel/messages/catalog.py

 from copy import copy
 import re
 import time
+import sys
 
 from babel import __version__ as VERSION
 from babel.core import Locale

babel/messages/jslexer.py

     '>>>=', '&', '&=', '|', '|=', '&&', '||', '^', '^=', '(', ')',
     '[', ']', '{', '}', '!', '--', '++', '~', ',', ';', '.', ':'
 ]
-operators.sort(lambda a, b: cmp(-len(a), -len(b)))
+operators.sort(key=lambda a: -len(a))
 
 escapes = {'b': '\b', 'f': '\f', 'n': '\n', 'r': '\r', 't': '\t'}
 
                 exp -= self.int_prec[0] - 1
             # Exponent grouping
             elif self.int_prec[1]:
-                exp = int(exp) / self.int_prec[1] * self.int_prec[1]
+                exp = int(exp) // self.int_prec[1] * self.int_prec[1]
             if not have_decimal or not isinstance(value, Decimal):
                 value = float(value)
             if exp < 0:
     output formats.
     """
 
-    def compile(self, (op, args)):
+    def compile(self, op_args):
+        op, args = op_args
         return getattr(self, 'compile_' + op)(*args)
 
     compile_n = lambda x: 'n'

babel/tests/dates.py

 
 from datetime import date, datetime, time, timedelta
 import doctest
-import new
+import sys
+if sys.version_info < (3, 0):
+    import new
 import unittest
 
 from pytz import timezone
         UTC = FixedOffsetTimezone(0, 'UTC')
         def fake_localize(self, dt, is_dst=False):
             raise NotImplementedError()
-        UTC.localize = new.instancemethod(fake_localize, UTC, UTC.__class__)
+        if sys.version_info >= (3, 0):
+            UTC.localize = fake_localize
+        else:
+            UTC.localize = new.instancemethod(fake_localize, UTC, UTC.__class__)
         # This is important to trigger the actual bug (#257)
         self.assertEqual(False, hasattr(UTC, 'normalize'))
         return UTC

scripts/dump_data.py

 # individuals. For the exact contribution history, see the revision
 # history and logs, available at http://babel.edgewall.org/log/.
 
+import sys
+if sys.version_info >= (3, 0):
+    sys.exit("dump_data only runs under Python 2.X. Sorry...")
+
 from optparse import OptionParser
 from pprint import pprint
-import sys
 
 from babel.localedata import load, LocaleDataDict
 

scripts/dump_global.py

 # individuals. For the exact contribution history, see the revision
 # history and logs, available at http://babel.edgewall.org/log/.
 
+import sys
+if sys.version_info >= (3, 0):
+    sys.exit("dump_global only runs under Python 2.X. Sorry...")
+
 import cPickle as pickle
 import os
 from pprint import pprint
-import sys
 
 import babel
 

scripts/import_cldr.py

 # individuals. For the exact contribution history, see the revision
 # history and logs, available at http://babel.edgewall.org/log/.
 
+import sys
+if sys.version_info >= (3, 0):
+    sys.exit("import_cldr only runs under Python 2.X. Sorry...")
+
 import cPickle as pickle
 from optparse import OptionParser
 import os
 import re
-import sys
 try:
     from xml.etree.ElementTree import parse
 except ImportError: