diff --git a/src/light9/typedgraph.py b/src/light9/typedgraph.py --- a/src/light9/typedgraph.py +++ b/src/light9/typedgraph.py @@ -44,6 +44,7 @@ def _convLiteral(objType: Type[_ObjType] for outType, dtypes in [ (float, (XSD['integer'], XSD['double'], XSD['decimal'])), (int, (XSD['integer'],)), + (bool, (XSD['boolean'],)), # todo tests (str, ()), ]: for t in _expandUnion(objType): diff --git a/src/light9/typedgraph_test.py b/src/light9/typedgraph_test.py --- a/src/light9/typedgraph_test.py +++ b/src/light9/typedgraph_test.py @@ -19,6 +19,8 @@ g = cast( :float1 0.0; :float2 1.0e1; :float3 0.5; + :boolt true; + :boolf false; :color "#ffffff"^^:hexColor; :definitelyAString "hello" . ''')) @@ -89,6 +91,9 @@ class TestTypedValueReturnsBasicTypes: assert type(tv) == Literal assert tv.datatype == L9['hexColor'] + def test_getsBoolean(self): + assert typedValue(bool, g, subj, L9['boolt']) + assert not typedValue(bool, g, subj, L9['boolf']) class TestTypedValueDoesntDoInappropriateUriStringConversions: