mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
Fix handlers for 'with' syntax in Transaction object
This commit is contained in:
@@ -330,6 +330,8 @@ static PyGetSetDef PGF_getseters[] = {
|
||||
};
|
||||
|
||||
static PyMemberDef PGF_members[] = {
|
||||
// {"revision", T_PYSSIZET, offsetof(PGFObject, revision), READONLY,
|
||||
// "the revision number of this PGF"},
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
||||
@@ -18,7 +18,9 @@ def gr2(gr1):
|
||||
return gr1
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def gr3(gr1):
|
||||
def gr3():
|
||||
# TODO how to avoid reloading from file?
|
||||
gr1 = readPGF("../haskell/tests/basic.pgf")
|
||||
with gr1.newTransaction("bar_branch") as t:
|
||||
t.createFunction("bar", ty, 0, prob),
|
||||
t.createCategory("R", [(BIND_TYPE_EXPLICIT, "x", ty)], prob)
|
||||
@@ -62,8 +64,8 @@ def test_extended_function_prob(gr2):
|
||||
|
||||
# gr3
|
||||
|
||||
# def test_branched_functions(gr3):
|
||||
# assert gr3.functions == ["bar", "c", "ind", "s", "z"]
|
||||
#
|
||||
# def test_branched_function_type(gr3):
|
||||
# assert gr3.functionType("bar") == ty
|
||||
def test_branched_functions(gr3):
|
||||
assert gr3.functions == ["bar", "c", "ind", "s", "z"]
|
||||
|
||||
def test_branched_function_type(gr3):
|
||||
assert gr3.functionType("bar") == ty
|
||||
|
||||
@@ -47,6 +47,7 @@ Transaction_commit(TransactionObject *self, PyObject *args)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pgf_free_revision(self->pgf->db, self->pgf->revision);
|
||||
self->pgf->revision = self->revision;
|
||||
|
||||
Py_RETURN_TRUE;
|
||||
@@ -156,10 +157,10 @@ Transaction_dropCategory(TransactionObject *self, PyObject *args)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
static TransactionObject *
|
||||
Transaction_enter(TransactionObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
Py_RETURN_TRUE;
|
||||
return self;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
||||
Reference in New Issue
Block a user