mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-03 16:22:52 -06:00
Fill in literal cases in Python unmarshaller (untested)
This commit is contained in:
@@ -856,7 +856,7 @@ Type_richcompare(TypeObject *t1, TypeObject *t2, int op)
|
|||||||
} else if (op == Py_NE) {
|
} else if (op == Py_NE) {
|
||||||
if (cmp) Py_RETURN_FALSE; else Py_RETURN_TRUE;
|
if (cmp) Py_RETURN_FALSE; else Py_RETURN_TRUE;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError, "the operation is not supported");
|
PyErr_SetString(PyExc_TypeError, "comparison operation not supported");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,17 +53,20 @@ PgfExpr eimplarg(PgfUnmarshaller *this, PgfExpr expr)
|
|||||||
|
|
||||||
PgfLiteral lint(PgfUnmarshaller *this, size_t size, uintmax_t *v)
|
PgfLiteral lint(PgfUnmarshaller *this, size_t size, uintmax_t *v)
|
||||||
{
|
{
|
||||||
return 0;
|
PyObject *i = PyLong_FromUnsignedLong(*v);
|
||||||
|
return (PgfLiteral) i;
|
||||||
}
|
}
|
||||||
|
|
||||||
PgfLiteral lflt(PgfUnmarshaller *this, double v)
|
PgfLiteral lflt(PgfUnmarshaller *this, double v)
|
||||||
{
|
{
|
||||||
return 0;
|
PyObject *d = PyFloat_FromDouble(v);
|
||||||
|
return (PgfLiteral) d;
|
||||||
}
|
}
|
||||||
|
|
||||||
PgfLiteral lstr(PgfUnmarshaller *this, PgfText *v)
|
PgfLiteral lstr(PgfUnmarshaller *this, PgfText *v)
|
||||||
{
|
{
|
||||||
return 0;
|
PyObject *s = PyUnicode_FromStringAndSize(v->text, v->size);
|
||||||
|
return (PgfLiteral) s;
|
||||||
}
|
}
|
||||||
|
|
||||||
PgfType dtyp(PgfUnmarshaller *this, int n_hypos, PgfTypeHypo *hypos, PgfText *cat, int n_exprs, PgfExpr *exprs)
|
PgfType dtyp(PgfUnmarshaller *this, int n_hypos, PgfTypeHypo *hypos, PgfText *cat, int n_exprs, PgfExpr *exprs)
|
||||||
@@ -79,7 +82,7 @@ PgfType dtyp(PgfUnmarshaller *this, int n_hypos, PgfTypeHypo *hypos, PgfText *ca
|
|||||||
|
|
||||||
void free_ref(PgfUnmarshaller *this, object x)
|
void free_ref(PgfUnmarshaller *this, object x)
|
||||||
{
|
{
|
||||||
return;
|
Py_XDECREF(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PgfUnmarshallerVtbl unmarshallervtbl =
|
static PgfUnmarshallerVtbl unmarshallervtbl =
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ def test_readPGF_GF():
|
|||||||
with pytest.raises(pgf.PGFError):
|
with pytest.raises(pgf.PGFError):
|
||||||
pgf.readPGF("../haskell/tests/basic.gf")
|
pgf.readPGF("../haskell/tests/basic.gf")
|
||||||
|
|
||||||
@pytest.mark.skip(reason="Bug in runtime")
|
@pytest.mark.skip(reason="Unhandled case in runtime")
|
||||||
def test_readPGF_NGF(NGF):
|
def test_readPGF_NGF(NGF):
|
||||||
with pytest.raises(pgf.PGFError):
|
with pytest.raises(pgf.PGFError):
|
||||||
pgf.readPGF("./basic.ngf")
|
pgf.readPGF("./basic.ngf")
|
||||||
@@ -34,7 +34,7 @@ def test_bootNGF_GF():
|
|||||||
with pytest.raises(pgf.PGFError):
|
with pytest.raises(pgf.PGFError):
|
||||||
pgf.bootNGF("../haskell/tests/basic.gf", "./abc.ngf")
|
pgf.bootNGF("../haskell/tests/basic.gf", "./abc.ngf")
|
||||||
|
|
||||||
@pytest.mark.skip(reason="Bug in runtime")
|
@pytest.mark.skip(reason="Unhandled case in runtime")
|
||||||
def test_bootNGF_NGF(NGF):
|
def test_bootNGF_NGF(NGF):
|
||||||
with pytest.raises(pgf.PGFError):
|
with pytest.raises(pgf.PGFError):
|
||||||
pgf.bootNGF("./basic.ngf", "./abc.ngf")
|
pgf.bootNGF("./basic.ngf", "./abc.ngf")
|
||||||
@@ -45,17 +45,17 @@ def test_bootNGF_existing(NGF):
|
|||||||
|
|
||||||
# readNGF
|
# readNGF
|
||||||
|
|
||||||
@pytest.mark.skip(reason="Bug in runtime")
|
@pytest.mark.skip(reason="Unhandled case in runtime")
|
||||||
def test_readNGF_non_existant():
|
def test_readNGF_non_existant():
|
||||||
with pytest.raises(FileNotFoundError):
|
with pytest.raises(FileNotFoundError):
|
||||||
pgf.readNGF("./abc.ngf")
|
pgf.readNGF("./abc.ngf")
|
||||||
|
|
||||||
@pytest.mark.skip(reason="Bug in runtime")
|
@pytest.mark.skip(reason="Unhandled case in runtime")
|
||||||
def test_readNGF_GF():
|
def test_readNGF_GF():
|
||||||
with pytest.raises(pgf.PGFError):
|
with pytest.raises(pgf.PGFError):
|
||||||
pgf.readNGF("../haskell/tests/basic.gf")
|
pgf.readNGF("../haskell/tests/basic.gf")
|
||||||
|
|
||||||
@pytest.mark.skip(reason="Bug in runtime")
|
@pytest.mark.skip(reason="Unhandled case in runtime")
|
||||||
def test_readNGF_PGF():
|
def test_readNGF_PGF():
|
||||||
with pytest.raises(pgf.PGFError):
|
with pytest.raises(pgf.PGFError):
|
||||||
pgf.readNGF("../haskell/tests/basic.pgf")
|
pgf.readNGF("../haskell/tests/basic.pgf")
|
||||||
|
|||||||
Reference in New Issue
Block a user