Kaydet (Commit) ba54edad authored tarafından Antoine Pitrou's avatar Antoine Pitrou

convert test_locale to unittest, and add a mechanism to override localconv()…

convert test_locale to unittest, and add a mechanism to override localconv() results for further testing (#1864, #1222)
üst 5fdfa3e3
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
""" """
import sys, encodings, encodings.aliases import sys, encodings, encodings.aliases
import functools
# Try importing the _locale module. # Try importing the _locale module.
# #
...@@ -87,6 +88,21 @@ except ImportError: ...@@ -87,6 +88,21 @@ except ImportError:
""" """
return s 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 ### Number formatting APIs
# Author: Martin von Loewis # Author: Martin von Loewis
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment