diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2008-07-25 21:45:08 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2008-07-25 21:45:08 (GMT) |
commit | 83d6a87a40711c6012ef856f4a2e6e7b2c30cedf (patch) | |
tree | 955f041d0f827f5660c0823d9eee0480b9448750 /Lib/locale.py | |
parent | 6e1df8d0d44817a7b9810c7d8b5c81423fb52cdb (diff) | |
download | cpython-83d6a87a40711c6012ef856f4a2e6e7b2c30cedf.zip cpython-83d6a87a40711c6012ef856f4a2e6e7b2c30cedf.tar.gz cpython-83d6a87a40711c6012ef856f4a2e6e7b2c30cedf.tar.bz2 |
Merged revisions 65237 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r65237 | antoine.pitrou | 2008-07-25 22:40:19 +0200 (ven., 25 juil. 2008) | 3 lines
convert test_locale to unittest, and add a mechanism to override localconv() results for further testing (#1864, #1222)
........
Diffstat (limited to 'Lib/locale.py')
-rw-r--r-- | Lib/locale.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/locale.py b/Lib/locale.py index 2f8cd85..0bed19e 100644 --- a/Lib/locale.py +++ b/Lib/locale.py @@ -13,6 +13,7 @@ import sys, encodings, encodings.aliases from builtins import str as _builtin_str +import functools # Try importing the _locale module. # @@ -94,6 +95,21 @@ if 'strxfrm' not in globals(): if 'strcoll' not in globals(): strcoll = _strcoll + +_localeconv = localeconv + +# With this dict, you can override some items of localeconv's return value. +# This is useful for testing purposes. +_override_localeconv = {} + +@functools.wraps(_localeconv) +def localeconv(): + d = _localeconv() + if _override_localeconv: + d.update(_override_localeconv) + return d + + ### Number formatting APIs # Author: Martin von Loewis |