mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
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) ........
This commit is contained in:
parent
6e1df8d0d4
commit
83d6a87a40
2 changed files with 234 additions and 78 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue