summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_locale.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-06-26 00:11:06 (GMT)
committerGitHub <noreply@github.com>2018-06-26 00:11:06 (GMT)
commit937ee9e745d7ff3c2010b927903c0e2a83623324 (patch)
tree39e60ea2d4770bde9800159f2f4e569e0fda729b /Lib/test/test_locale.py
parentfdd6e0bf18517c3dc5e24c48fbfe890229fad1b5 (diff)
downloadcpython-937ee9e745d7ff3c2010b927903c0e2a83623324.zip
cpython-937ee9e745d7ff3c2010b927903c0e2a83623324.tar.gz
cpython-937ee9e745d7ff3c2010b927903c0e2a83623324.tar.bz2
Revert "bpo-33671: Add support.MS_WINDOWS and support.MACOS (GH-7800)" (GH-7919)
This reverts commit 8fbbdf0c3107c3052659e166f73990b466eacbb0.
Diffstat (limited to 'Lib/test/test_locale.py')
-rw-r--r--Lib/test/test_locale.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py
index 11bf254..e2c2178 100644
--- a/Lib/test/test_locale.py
+++ b/Lib/test/test_locale.py
@@ -1,10 +1,9 @@
-import codecs
+from test.support import verbose, is_android, check_warnings
+import unittest
import locale
import sys
-import unittest
+import codecs
import warnings
-from test import support
-
class BaseLocalizedTest(unittest.TestCase):
#
@@ -13,7 +12,7 @@ class BaseLocalizedTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
- if support.MACOS:
+ if sys.platform == 'darwin':
import os
tlocs = ("en_US.UTF-8", "en_US.ISO8859-1", "en_US")
if int(os.uname().release.split('.')[0]) < 10:
@@ -45,7 +44,7 @@ class BaseLocalizedTest(unittest.TestCase):
oldlocale = locale.setlocale(self.locale_type)
self.addCleanup(locale.setlocale, self.locale_type, oldlocale)
locale.setlocale(self.locale_type, self.enUS_locale)
- if support.verbose:
+ if verbose:
print("testing with %r..." % self.enUS_locale, end=' ', flush=True)
@@ -145,7 +144,7 @@ class BaseFormattingTest(object):
func(format, value, **format_opts), out)
def _test_format(self, format, value, out, **format_opts):
- with support.check_warnings(('', DeprecationWarning)):
+ with check_warnings(('', DeprecationWarning)):
self._test_formatfunc(format, value, out,
func=locale.format, **format_opts)
@@ -234,7 +233,7 @@ class TestFormatPatternArg(unittest.TestCase):
# Test handling of pattern argument of format
def test_onlyOnePattern(self):
- with support.check_warnings(('', DeprecationWarning)):
+ with check_warnings(('', DeprecationWarning)):
# Issue 2522: accept exactly one % pattern, and no extra chars.
self.assertRaises(ValueError, locale.format, "%f\n", 'foo')
self.assertRaises(ValueError, locale.format, "%f\r", 'foo')
@@ -366,7 +365,7 @@ class TestEnUSCollation(BaseLocalizedTest, TestCollation):
enc = codecs.lookup(locale.getpreferredencoding(False) or 'ascii').name
if enc not in ('utf-8', 'iso8859-1', 'cp1252'):
raise unittest.SkipTest('encoding not suitable')
- if enc != 'iso8859-1' and (support.MACOS or support.ANDROID or
+ if enc != 'iso8859-1' and (sys.platform == 'darwin' or is_android or
sys.platform.startswith('freebsd')):
raise unittest.SkipTest('wcscoll/wcsxfrm have known bugs')
BaseLocalizedTest.setUp(self)
@@ -527,7 +526,7 @@ class TestMiscellaneous(unittest.TestCase):
# Unsupported locale on this system
self.skipTest('test needs Turkish locale')
loc = locale.getlocale(locale.LC_CTYPE)
- if support.verbose:
+ if verbose:
print('testing with %a' % (loc,), end=' ', flush=True)
locale.setlocale(locale.LC_CTYPE, loc)
self.assertEqual(loc, locale.getlocale(locale.LC_CTYPE))