convert test_locale to unittest, and add a mechanism to override localconv() results for further testing (#1864, #1222)

This commit is contained in:
Antoine Pitrou 2008-07-25 20:40:19 +00:00
parent 5fdfa3e36d
commit ba54edadb3
2 changed files with 270 additions and 111 deletions

View file

@ -12,6 +12,7 @@
"""
import sys, encodings, encodings.aliases
import functools
# Try importing the _locale module.
#
@ -87,6 +88,21 @@ except ImportError:
"""
return s
_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