Python locale.LC_CTYPE Examples
The following are 30
code examples of locale.LC_CTYPE().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
locale
, or try the search function
.
Example #1
Source File: test_locale.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_getsetlocale_issue1813(self): # Issue #1813: setting and getting the locale under a Turkish locale oldlocale = locale.getlocale() self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) for loc in ('tr_TR', 'tr_TR.UTF-8', 'tr_TR.ISO8859-9'): try: locale.setlocale(locale.LC_CTYPE, loc) break except locale.Error: continue else: # Unsupported locale on this system self.skipTest('test needs Turkish locale') loc = locale.getlocale() try: locale.setlocale(locale.LC_CTYPE, loc) except Exception as e: self.fail("Failed to set locale %r (default locale is %r): %r" % (loc, oldlocale, e)) self.assertEqual(loc, locale.getlocale())
Example #2
Source File: test_re.py From ironpython3 with Apache License 2.0 | 6 votes |
def test_locale_caching(self): # Issue #22410 oldlocale = locale.setlocale(locale.LC_CTYPE) self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) for loc in 'en_US.iso88591', 'en_US.utf8': try: locale.setlocale(locale.LC_CTYPE, loc) except locale.Error: # Unsupported locale on this system self.skipTest('test needs %s locale' % loc) re.purge() self.check_en_US_iso88591() self.check_en_US_utf8() re.purge() self.check_en_US_utf8() self.check_en_US_iso88591()
Example #3
Source File: test_locale.py From gcblue with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_getsetlocale_issue1813(self): # Issue #1813: setting and getting the locale under a Turkish locale oldlocale = locale.getlocale() self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) for loc in ('tr_TR', 'tr_TR.UTF-8', 'tr_TR.ISO8859-9'): try: locale.setlocale(locale.LC_CTYPE, loc) break except locale.Error: continue else: # Unsupported locale on this system self.skipTest('test needs Turkish locale') loc = locale.getlocale() try: locale.setlocale(locale.LC_CTYPE, loc) except Exception as e: self.fail("Failed to set locale %r (default locale is %r): %r" % (loc, oldlocale, e)) self.assertEqual(loc, locale.getlocale())
Example #4
Source File: test_re.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def test_locale_caching(self): # Issue #22410 oldlocale = locale.setlocale(locale.LC_CTYPE) self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) for loc in 'en_US.iso88591', 'en_US.utf8': try: locale.setlocale(locale.LC_CTYPE, loc) except locale.Error: # Unsupported locale on this system self.skipTest('test needs %s locale' % loc) re.purge() self.check_en_US_iso88591() self.check_en_US_utf8() re.purge() self.check_en_US_utf8() self.check_en_US_iso88591()
Example #5
Source File: test_re.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def test_locale_caching(self): # Issue #22410 oldlocale = locale.setlocale(locale.LC_CTYPE) self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) for loc in 'en_US.iso88591', 'en_US.utf8': try: locale.setlocale(locale.LC_CTYPE, loc) except locale.Error: # Unsupported locale on this system self.skipTest('test needs %s locale' % loc) re.purge() self.check_en_US_iso88591() self.check_en_US_utf8() re.purge() self.check_en_US_utf8() self.check_en_US_iso88591()
Example #6
Source File: test_re.py From oss-ftp with MIT License | 6 votes |
def test_locale_caching(self): # Issue #22410 oldlocale = locale.setlocale(locale.LC_CTYPE) self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) for loc in 'en_US.iso88591', 'en_US.utf8': try: locale.setlocale(locale.LC_CTYPE, loc) except locale.Error: # Unsupported locale on this system self.skipTest('test needs %s locale' % loc) re.purge() self.check_en_US_iso88591() self.check_en_US_utf8() re.purge() self.check_en_US_utf8() self.check_en_US_iso88591()
Example #7
Source File: test_locale.py From oss-ftp with MIT License | 6 votes |
def test_getsetlocale_issue1813(self): # Issue #1813: setting and getting the locale under a Turkish locale oldlocale = locale.getlocale() self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) for loc in ('tr_TR', 'tr_TR.UTF-8', 'tr_TR.ISO8859-9'): try: locale.setlocale(locale.LC_CTYPE, loc) break except locale.Error: continue else: # Unsupported locale on this system self.skipTest('test needs Turkish locale') loc = locale.getlocale() try: locale.setlocale(locale.LC_CTYPE, loc) except Exception as e: self.fail("Failed to set locale %r (default locale is %r): %r" % (loc, oldlocale, e)) self.assertEqual(loc, locale.getlocale())
Example #8
Source File: test_re.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def test_locale_caching(self): # Issue #22410 oldlocale = locale.setlocale(locale.LC_CTYPE) self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) for loc in 'en_US.iso88591', 'en_US.utf8': try: locale.setlocale(locale.LC_CTYPE, loc) except locale.Error: # Unsupported locale on this system self.skipTest('test needs %s locale' % loc) re.purge() self.check_en_US_iso88591() self.check_en_US_utf8() re.purge() self.check_en_US_utf8() self.check_en_US_iso88591()
Example #9
Source File: test_re.py From CTFCrackTools with GNU General Public License v3.0 | 6 votes |
def test_locale_caching(self): # Issue #22410 oldlocale = locale.setlocale(locale.LC_CTYPE) self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) for loc in 'en_US.iso88591', 'en_US.utf8': try: locale.setlocale(locale.LC_CTYPE, loc) except locale.Error: # Unsupported locale on this system self.skipTest('test needs %s locale' % loc) re.purge() self.check_en_US_iso88591() self.check_en_US_utf8() re.purge() self.check_en_US_utf8() self.check_en_US_iso88591()
Example #10
Source File: test_re.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_locale_caching(self): # Issue #22410 oldlocale = locale.setlocale(locale.LC_CTYPE) self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) for loc in 'en_US.iso88591', 'en_US.utf8': try: locale.setlocale(locale.LC_CTYPE, loc) except locale.Error: # Unsupported locale on this system self.skipTest('test needs %s locale' % loc) re.purge() self.check_en_US_iso88591() self.check_en_US_utf8() re.purge() self.check_en_US_utf8() self.check_en_US_iso88591()
Example #11
Source File: test_locale.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_setlocale_category(self): locale.setlocale(locale.LC_ALL) locale.setlocale(locale.LC_TIME) locale.setlocale(locale.LC_CTYPE) locale.setlocale(locale.LC_COLLATE) locale.setlocale(locale.LC_MONETARY) locale.setlocale(locale.LC_NUMERIC) # crasher from bug #7419 self.assertRaises(locale.Error, locale.setlocale, 12345)
Example #12
Source File: test_re.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def check_en_US_iso88591(self): locale.setlocale(locale.LC_CTYPE, 'en_US.iso88591') self.assertTrue(re.match(b'\xc5\xe5', b'\xc5\xe5', re.L|re.I)) self.assertTrue(re.match(b'\xc5', b'\xe5', re.L|re.I)) self.assertTrue(re.match(b'\xe5', b'\xc5', re.L|re.I)) self.assertTrue(re.match(b'(?Li)\xc5\xe5', b'\xc5\xe5')) self.assertTrue(re.match(b'(?Li)\xc5', b'\xe5')) self.assertTrue(re.match(b'(?Li)\xe5', b'\xc5'))
Example #13
Source File: test_re.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def check_en_US_iso88591(self): locale.setlocale(locale.LC_CTYPE, 'en_US.iso88591') self.assertTrue(re.match(b'\xc5\xe5', b'\xc5\xe5', re.L|re.I)) self.assertTrue(re.match(b'\xc5', b'\xe5', re.L|re.I)) self.assertTrue(re.match(b'\xe5', b'\xc5', re.L|re.I)) self.assertTrue(re.match(b'(?Li)\xc5\xe5', b'\xc5\xe5')) self.assertTrue(re.match(b'(?Li)\xc5', b'\xe5')) self.assertTrue(re.match(b'(?Li)\xe5', b'\xc5'))
Example #14
Source File: test_locale.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_setlocale_category(self): locale.setlocale(locale.LC_ALL) locale.setlocale(locale.LC_TIME) locale.setlocale(locale.LC_CTYPE) locale.setlocale(locale.LC_COLLATE) locale.setlocale(locale.LC_MONETARY) locale.setlocale(locale.LC_NUMERIC) # crasher from bug #7419 self.assertRaises(locale.Error, locale.setlocale, 12345)
Example #15
Source File: test_codecs.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_lookup_issue1813(self): # Issue #1813: under Turkish locales, lookup of some codecs failed # because 'I' is lowercased as a dotless "i" oldlocale = locale.getlocale(locale.LC_CTYPE) self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) try: locale.setlocale(locale.LC_CTYPE, 'tr_TR') except locale.Error: # Unsupported locale on this system self.skipTest('test needs Turkish locale') c = codecs.lookup('ASCII') self.assertEqual(c.name, 'ascii')
Example #16
Source File: test_locale.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_setlocale_category(self): locale.setlocale(locale.LC_ALL) locale.setlocale(locale.LC_TIME) locale.setlocale(locale.LC_CTYPE) locale.setlocale(locale.LC_COLLATE) locale.setlocale(locale.LC_MONETARY) locale.setlocale(locale.LC_NUMERIC) # crasher from bug #7419 self.assertRaises(locale.Error, locale.setlocale, 12345)
Example #17
Source File: test_locale.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_getsetlocale_issue1813(self): # Issue #1813: setting and getting the locale under a Turkish locale oldlocale = locale.setlocale(locale.LC_CTYPE) self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) try: locale.setlocale(locale.LC_CTYPE, 'tr_TR') except locale.Error: # Unsupported locale on this system self.skipTest('test needs Turkish locale') loc = locale.getlocale(locale.LC_CTYPE) if verbose: print('testing with %a' % (loc,), end=' ', flush=True) locale.setlocale(locale.LC_CTYPE, loc) self.assertEqual(loc, locale.getlocale(locale.LC_CTYPE))
Example #18
Source File: test_codecs.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_lookup_issue1813(self): # Issue #1813: under Turkish locales, lookup of some codecs failed # because 'I' is lowercased as "ı" (dotless i) oldlocale = locale.setlocale(locale.LC_CTYPE) self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) try: locale.setlocale(locale.LC_CTYPE, 'tr_TR') except locale.Error: # Unsupported locale on this system self.skipTest('test needs Turkish locale') c = codecs.lookup('ASCII') self.assertEqual(c.name, 'ascii')
Example #19
Source File: test_re.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def check_en_US_utf8(self): locale.setlocale(locale.LC_CTYPE, 'en_US.utf8') self.assertTrue(re.match(b'\xc5\xe5', b'\xc5\xe5', re.L|re.I)) self.assertIsNone(re.match(b'\xc5', b'\xe5', re.L|re.I)) self.assertIsNone(re.match(b'\xe5', b'\xc5', re.L|re.I)) self.assertTrue(re.match(b'(?Li)\xc5\xe5', b'\xc5\xe5')) self.assertIsNone(re.match(b'(?Li)\xc5', b'\xe5')) self.assertIsNone(re.match(b'(?Li)\xe5', b'\xc5'))
Example #20
Source File: test_locale.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_setlocale_category(self): locale.setlocale(locale.LC_ALL) locale.setlocale(locale.LC_TIME) locale.setlocale(locale.LC_CTYPE) locale.setlocale(locale.LC_COLLATE) locale.setlocale(locale.LC_MONETARY) locale.setlocale(locale.LC_NUMERIC) # crasher from bug #7419 self.assertRaises(locale.Error, locale.setlocale, 12345)
Example #21
Source File: test_locale.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_getsetlocale_issue1813(self): # Issue #1813: setting and getting the locale under a Turkish locale oldlocale = locale.getlocale() self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) try: locale.setlocale(locale.LC_CTYPE, 'tr_TR') except locale.Error: # Unsupported locale on this system self.skipTest('test needs Turkish locale') loc = locale.getlocale() locale.setlocale(locale.LC_CTYPE, loc) self.assertEqual(loc, locale.getlocale())
Example #22
Source File: test_codecs.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_lookup_issue1813(self): # Issue #1813: under Turkish locales, lookup of some codecs failed # because 'I' is lowercased as a dotless "i" oldlocale = locale.getlocale(locale.LC_CTYPE) self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) try: locale.setlocale(locale.LC_CTYPE, 'tr_TR') except locale.Error: # Unsupported locale on this system self.skipTest('test needs Turkish locale') c = codecs.lookup('ASCII') self.assertEqual(c.name, 'ascii')
Example #23
Source File: test_codecs.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_lookup_issue1813(self): # Issue #1813: under Turkish locales, lookup of some codecs failed # because 'I' is lowercased as a dotless "i" oldlocale = locale.getlocale(locale.LC_CTYPE) self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) try: locale.setlocale(locale.LC_CTYPE, 'tr_TR') except locale.Error: # Unsupported locale on this system self.skipTest('test needs Turkish locale') c = codecs.lookup('ASCII') self.assertEqual(c.name, 'ascii')
Example #24
Source File: test_locale.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_getsetlocale_issue1813(self): # Issue #1813: setting and getting the locale under a Turkish locale oldlocale = locale.getlocale() self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) try: locale.setlocale(locale.LC_CTYPE, 'tr_TR') except locale.Error: # Unsupported locale on this system self.skipTest('test needs Turkish locale') loc = locale.getlocale() locale.setlocale(locale.LC_CTYPE, loc) self.assertEqual(loc, locale.getlocale())
Example #25
Source File: test_locale.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_setlocale_category(self): locale.setlocale(locale.LC_ALL) locale.setlocale(locale.LC_TIME) locale.setlocale(locale.LC_CTYPE) locale.setlocale(locale.LC_COLLATE) locale.setlocale(locale.LC_MONETARY) locale.setlocale(locale.LC_NUMERIC) # crasher from bug #7419 self.assertRaises(locale.Error, locale.setlocale, 12345)
Example #26
Source File: test_locale.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def test_setlocale_category(self): locale.setlocale(locale.LC_ALL) locale.setlocale(locale.LC_TIME) locale.setlocale(locale.LC_CTYPE) locale.setlocale(locale.LC_COLLATE) locale.setlocale(locale.LC_MONETARY) locale.setlocale(locale.LC_NUMERIC) # crasher from bug #7419 self.assertRaises(locale.Error, locale.setlocale, 12345)
Example #27
Source File: test_locale.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_setlocale_unicode(self): oldlocale = locale.getlocale() self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) user_locale = locale.setlocale(locale.LC_CTYPE, '') unicode_locale = user_locale.decode('utf-8') user_locale2 = locale.setlocale(locale.LC_CTYPE, unicode_locale) self.assertEqual(user_locale, user_locale2)
Example #28
Source File: test_codecs.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_lookup_issue1813(self): # Issue #1813: under Turkish locales, lookup of some codecs failed # because 'I' is lowercased as a dotless "i" oldlocale = locale.getlocale(locale.LC_CTYPE) self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) try: locale.setlocale(locale.LC_CTYPE, 'tr_TR') except locale.Error: # Unsupported locale on this system self.skipTest('test needs Turkish locale') c = codecs.lookup('ASCII') self.assertEqual(c.name, 'ascii')
Example #29
Source File: test_re.py From ironpython2 with Apache License 2.0 | 5 votes |
def check_en_US_utf8(self): locale.setlocale(locale.LC_CTYPE, 'en_US.utf8') self.assertTrue(re.match(b'\xc5\xe5', b'\xc5\xe5', re.L|re.I)) self.assertIsNone(re.match(b'\xc5', b'\xe5', re.L|re.I)) self.assertIsNone(re.match(b'\xe5', b'\xc5', re.L|re.I)) self.assertTrue(re.match(b'(?Li)\xc5\xe5', b'\xc5\xe5')) self.assertIsNone(re.match(b'(?Li)\xc5', b'\xe5')) self.assertIsNone(re.match(b'(?Li)\xe5', b'\xc5'))
Example #30
Source File: test_locale.py From BinderFilter with MIT License | 5 votes |
def test_setlocale_category(self): locale.setlocale(locale.LC_ALL) locale.setlocale(locale.LC_TIME) locale.setlocale(locale.LC_CTYPE) locale.setlocale(locale.LC_COLLATE) locale.setlocale(locale.LC_MONETARY) locale.setlocale(locale.LC_NUMERIC) # crasher from bug #7419 self.assertRaises(locale.Error, locale.setlocale, 12345)