Back to index

python3.2  3.2.2
Classes | Functions | Variables
test.test_locale Namespace Reference

Classes

class  BaseLocalizedTest
class  BaseCookedTest
class  CCookedTest
class  EnUSCookedTest
class  FrFRCookedTest
class  BaseFormattingTest
class  EnUSNumberFormatting
class  TestFormatPatternArg
class  TestLocaleFormatString
class  TestNumberFormatting
class  TestEnUSNumberFormatting
class  TestCNumberFormatting
class  TestFrFRNumberFormatting
class  TestCollation
class  TestEnUSCollation
class  TestMiscellaneous

Functions

def get_enUS_locale
def test_main

Variables

 enUS_locale = None

Function Documentation

Definition at line 10 of file test_locale.py.

00010 
00011 def get_enUS_locale():
00012     global enUS_locale
00013     if sys.platform == 'darwin':
00014         import os
00015         tlocs = ("en_US.UTF-8", "en_US.ISO8859-1", "en_US")
00016         if int(os.uname()[2].split('.')[0]) < 10:
00017             # The locale test work fine on OSX 10.6, I (ronaldoussoren)
00018             # haven't had time yet to verify if tests work on OSX 10.5
00019             # (10.4 is known to be bad)
00020             raise unittest.SkipTest("Locale support on MacOSX is minimal")
00021     elif sys.platform.startswith("win"):
00022         tlocs = ("En", "English")
00023     else:
00024         tlocs = ("en_US.UTF-8", "en_US.ISO8859-1", "en_US.US-ASCII", "en_US")
00025     oldlocale = locale.setlocale(locale.LC_NUMERIC)
00026     for tloc in tlocs:
00027         try:
00028             locale.setlocale(locale.LC_NUMERIC, tloc)
00029         except locale.Error:
00030             continue
00031         break
00032     else:
00033         raise unittest.SkipTest(
00034             "Test locale not supported (tried %s)" % (', '.join(tlocs)))
00035     enUS_locale = tloc
00036     locale.setlocale(locale.LC_NUMERIC, oldlocale)
00037 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 411 of file test_locale.py.

00411 
00412 def test_main():
00413     tests = [
00414         TestMiscellaneous,
00415         TestFormatPatternArg,
00416         TestLocaleFormatString,
00417         TestEnUSNumberFormatting,
00418         TestCNumberFormatting,
00419         TestFrFRNumberFormatting,
00420         TestCollation
00421     ]
00422     # SkipTest can't be raised inside unittests, handle it manually instead
00423     try:
00424         get_enUS_locale()
00425     except unittest.SkipTest as e:
00426         if verbose:
00427             print("Some tests will be disabled: %s" % e)
00428     else:
00429         tests += [TestNumberFormatting, TestEnUSCollation]
00430     run_unittest(*tests)

Here is the call graph for this function:


Variable Documentation

Definition at line 8 of file test_locale.py.