MCPcopy Index your code
hub / github.com/python/cpython / test_surrogates

Method test_surrogates

Lib/test/test_str.py:872–896  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

870 or char == ' ')
871
872 def test_surrogates(self):
873 for s in ('a\uD800b\uDFFF', 'a\uDFFFb\uD800',
874 'a\uD800b\uDFFFa', 'a\uDFFFb\uD800a'):
875 self.assertTrue(s.islower())
876 self.assertFalse(s.isupper())
877 self.assertFalse(s.istitle())
878 for s in ('A\uD800B\uDFFF', 'A\uDFFFB\uD800',
879 'A\uD800B\uDFFFA', 'A\uDFFFB\uD800A'):
880 self.assertFalse(s.islower())
881 self.assertTrue(s.isupper())
882 self.assertTrue(s.istitle())
883
884 for meth_name in ('islower', 'isupper', 'istitle'):
885 meth = getattr(str, meth_name)
886 for s in ('\uD800', '\uDFFF', '\uD800\uD800', '\uDFFF\uDFFF'):
887 self.assertFalse(meth(s), '%a.%s() is False' % (s, meth_name))
888
889 for meth_name in ('isalpha', 'isalnum', 'isdigit', 'isspace',
890 'isdecimal', 'isnumeric',
891 'isidentifier', 'isprintable'):
892 meth = getattr(str, meth_name)
893 for s in ('\uD800', '\uDFFF', '\uD800\uD800', '\uDFFF\uDFFF',
894 'a\uD800b\uDFFF', 'a\uDFFFb\uD800',
895 'a\uD800b\uDFFFa', 'a\uDFFFb\uD800a'):
896 self.assertFalse(meth(s), '%a.%s() is False' % (s, meth_name))
897
898
899 def test_lower(self):

Callers

nothing calls this directly

Calls 6

methFunction · 0.85
assertTrueMethod · 0.80
islowerMethod · 0.80
assertFalseMethod · 0.80
isupperMethod · 0.80
istitleMethod · 0.80

Tested by

no test coverage detected