forked from GitHub/gf-core
Implement PGF_getStartCat in Python bindings
This commit is contained in:
@@ -1875,24 +1875,16 @@ PGF_getCategories(PGFObject *self, void *closure)
|
||||
return categories;
|
||||
}
|
||||
|
||||
static TypeObject*
|
||||
static TypeObject *
|
||||
PGF_getStartCat(PGFObject *self, void *closure)
|
||||
{
|
||||
TypeObject* pytype = (TypeObject*) pgf_TypeType.tp_alloc(&pgf_TypeType, 0);
|
||||
if (pytype == NULL)
|
||||
return NULL;
|
||||
|
||||
// // pytype->pool = gu_new_pool();
|
||||
// pytype->type = pgf_start_cat(self->pgf, /*pytype->pool,*/ &unmarshaller);
|
||||
// pytype->master = NULL;
|
||||
//
|
||||
// if (pytype->type == NULL) {
|
||||
PgfType type = pgf_start_cat(self->pgf, &unmarshaller);
|
||||
if (type == 0) {
|
||||
PyErr_SetString(PGFError, "The start category cannot be found");
|
||||
// Py_DECREF(pytype);
|
||||
return NULL;
|
||||
// }
|
||||
//
|
||||
// return pytype;
|
||||
}
|
||||
|
||||
return (TypeObject *)type;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -120,5 +120,6 @@ def test_functionType_wrong(PGF):
|
||||
assert PGF.functionType("c") != pgf.readType("N -> S -> X")
|
||||
|
||||
def test_startCat(PGF):
|
||||
with pytest.raises(pgf.PGFError):
|
||||
PGF.startCat()
|
||||
# with pytest.raises(pgf.PGFError):
|
||||
# PGF.startCat
|
||||
assert PGF.startCat == pgf.readType("S")
|
||||
|
||||
Reference in New Issue
Block a user