They are now only exposed as the unicodedata function.
self.assertEqual(result, self.expectedchecksum)
-class UnicodeFunctionsTest(unittest.TestCase):
- db = unicodedata
- old = False
-
- # Update this if the database changes. Make sure to do a full rebuild
- # (e.g. 'make distclean && make') to get the correct checksum.
- expectedchecksum = ('83cc43a2fbb779185832b4c049217d80b05bf349'
- if quicktest else
- '65670ae03a324c5f9e826a4de3e25bae4d73c9b7')
+class BaseUnicodeFunctionsTest:
def test_function_checksum(self):
db = self.db
self.assertEqual(eaw(char), 'A')
self.assertIs(self.db.name(char, None), None)
+class UnicodeFunctionsTest(unittest.TestCase, BaseUnicodeFunctionsTest):
+ db = unicodedata
+ old = False
+
+ # Update this if the database changes. Make sure to do a full rebuild
+ # (e.g. 'make distclean && make') to get the correct checksum.
+ expectedchecksum = ('83cc43a2fbb779185832b4c049217d80b05bf349'
+ if quicktest else
+ '65670ae03a324c5f9e826a4de3e25bae4d73c9b7')
+
def test_isxidstart(self):
self.assertTrue(self.db.isxidstart('S'))
self.assertTrue(self.db.isxidstart('\u0AD0')) # GUJARATI OM
['a', '\U0001F1FA\U0001F1E6', '\U0001F1FA\U0001F1F3'])
-class Unicode_3_2_0_FunctionsTest(UnicodeFunctionsTest):
+class Unicode_3_2_0_FunctionsTest(unittest.TestCase, BaseUnicodeFunctionsTest):
db = unicodedata.ucd_3_2_0
old = True
expectedchecksum = ('f4526159891a4b766dd48045646547178737ba09'
if quicktest else
'f217b8688d7bdff31db4207e078a96702f091597')
- test_grapheme_cluster_break = None
- test_indic_conjunct_break = None
- test_extended_pictographic = None
- test_grapheme_break = None
-
class UnicodeMiscTest(unittest.TestCase):
db = unicodedata
--- /dev/null
+Remove the :meth:`!isxidstart` and :meth:`!isxidcontinue` methods of
+:data:`unicodedata.ucd_3_2_0`. They are now only exposed as
+:func:`unicodedata.isxidstart` and :func:`unicodedata.isxidcontinue`.
return return_value;
}
-PyDoc_STRVAR(unicodedata_UCD_isxidstart__doc__,
-"isxidstart($self, chr, /)\n"
+PyDoc_STRVAR(unicodedata_isxidstart__doc__,
+"isxidstart($module, chr, /)\n"
"--\n"
"\n"
"Return True if the character has the XID_Start property, else False.");
-#define UNICODEDATA_UCD_ISXIDSTART_METHODDEF \
- {"isxidstart", (PyCFunction)unicodedata_UCD_isxidstart, METH_O, unicodedata_UCD_isxidstart__doc__},
+#define UNICODEDATA_ISXIDSTART_METHODDEF \
+ {"isxidstart", (PyCFunction)unicodedata_isxidstart, METH_O, unicodedata_isxidstart__doc__},
static PyObject *
-unicodedata_UCD_isxidstart_impl(PyObject *self, int chr);
+unicodedata_isxidstart_impl(PyObject *module, int chr);
static PyObject *
-unicodedata_UCD_isxidstart(PyObject *self, PyObject *arg)
+unicodedata_isxidstart(PyObject *module, PyObject *arg)
{
PyObject *return_value = NULL;
int chr;
goto exit;
}
chr = PyUnicode_READ_CHAR(arg, 0);
- return_value = unicodedata_UCD_isxidstart_impl(self, chr);
+ return_value = unicodedata_isxidstart_impl(module, chr);
exit:
return return_value;
}
-PyDoc_STRVAR(unicodedata_UCD_isxidcontinue__doc__,
-"isxidcontinue($self, chr, /)\n"
+PyDoc_STRVAR(unicodedata_isxidcontinue__doc__,
+"isxidcontinue($module, chr, /)\n"
"--\n"
"\n"
"Return True if the character has the XID_Continue property, else False.");
-#define UNICODEDATA_UCD_ISXIDCONTINUE_METHODDEF \
- {"isxidcontinue", (PyCFunction)unicodedata_UCD_isxidcontinue, METH_O, unicodedata_UCD_isxidcontinue__doc__},
+#define UNICODEDATA_ISXIDCONTINUE_METHODDEF \
+ {"isxidcontinue", (PyCFunction)unicodedata_isxidcontinue, METH_O, unicodedata_isxidcontinue__doc__},
static PyObject *
-unicodedata_UCD_isxidcontinue_impl(PyObject *self, int chr);
+unicodedata_isxidcontinue_impl(PyObject *module, int chr);
static PyObject *
-unicodedata_UCD_isxidcontinue(PyObject *self, PyObject *arg)
+unicodedata_isxidcontinue(PyObject *module, PyObject *arg)
{
PyObject *return_value = NULL;
int chr;
goto exit;
}
chr = PyUnicode_READ_CHAR(arg, 0);
- return_value = unicodedata_UCD_isxidcontinue_impl(self, chr);
+ return_value = unicodedata_isxidcontinue_impl(module, chr);
exit:
return return_value;
exit:
return return_value;
}
-/*[clinic end generated code: output=6991246310e3f2aa input=a9049054013a1b77]*/
+/*[clinic end generated code: output=0f09cc90f06ace76 input=a9049054013a1b77]*/
}
/*[clinic input]
-unicodedata.UCD.isxidstart
+unicodedata.isxidstart
- self: self
chr: int(accept={str})
/
[clinic start generated code]*/
static PyObject *
-unicodedata_UCD_isxidstart_impl(PyObject *self, int chr)
-/*[clinic end generated code: output=944005823c72c3ef input=9353f88d709c21fb]*/
+unicodedata_isxidstart_impl(PyObject *module, int chr)
+/*[clinic end generated code: output=7ae0e1a3915aa031 input=3812717f3a6bfc56]*/
{
- if (UCD_Check(self)) {
- const change_record *old = get_old_record(self, chr);
- if (old->category_changed == 0) {
- /* unassigned */
- Py_RETURN_FALSE;
- }
- }
-
return PyBool_FromLong(_PyUnicode_IsXidStart(chr));
}
/*[clinic input]
-unicodedata.UCD.isxidcontinue
+unicodedata.isxidcontinue
- self: self
chr: int(accept={str})
/
[clinic start generated code]*/
static PyObject *
-unicodedata_UCD_isxidcontinue_impl(PyObject *self, int chr)
-/*[clinic end generated code: output=9438dcbff5ca3e41 input=bbb8dd3ac0d2d709]*/
+unicodedata_isxidcontinue_impl(PyObject *module, int chr)
+/*[clinic end generated code: output=517caa8b38c73aed input=a971ed6e57cac374]*/
{
- if (UCD_Check(self)) {
- const change_record *old = get_old_record(self, chr);
- if (old->category_changed == 0) {
- /* unassigned */
- Py_RETURN_FALSE;
- }
- }
-
return PyBool_FromLong(_PyUnicode_IsXidContinue(chr));
}
UNICODEDATA_INDIC_CONJUNCT_BREAK_METHODDEF
UNICODEDATA_EXTENDED_PICTOGRAPHIC_METHODDEF
UNICODEDATA_ITER_GRAPHEMES_METHODDEF
+ UNICODEDATA_ISXIDSTART_METHODDEF
+ UNICODEDATA_ISXIDCONTINUE_METHODDEF
// The following definitions are shared between the module
// and the UCD class.
-#define DB_methods (unicodedata_functions + 4)
+#define DB_methods (unicodedata_functions + 6)
UNICODEDATA_UCD_DECIMAL_METHODDEF
UNICODEDATA_UCD_DIGIT_METHODDEF
UNICODEDATA_UCD_EAST_ASIAN_WIDTH_METHODDEF
UNICODEDATA_UCD_DECOMPOSITION_METHODDEF
UNICODEDATA_UCD_NAME_METHODDEF
- UNICODEDATA_UCD_ISXIDSTART_METHODDEF
- UNICODEDATA_UCD_ISXIDCONTINUE_METHODDEF
UNICODEDATA_UCD_LOOKUP_METHODDEF
UNICODEDATA_UCD_IS_NORMALIZED_METHODDEF
UNICODEDATA_UCD_NORMALIZE_METHODDEF