Changeset - 165fc8ed28ab
[Not reviewed]
default
0 2 0
drewp@bigasterisk.com - 20 months ago 2023-05-23 23:26:32
drewp@bigasterisk.com
clearly this approach is wrong
2 files changed with 5 insertions and 0 deletions:
0 comments (0 inline, 0 general)
light9/typedgraph.py
Show inline comments
 
@@ -72,6 +72,8 @@ def typedValue(objType: Type[_ObjType], 
 
    try:
 
        if ConvFrom == URIRef and _typeIncludes(ConvTo, URIRef):
 
            conv = obj
 
        elif ConvFrom == URIRef and issubclass(URIRef, ConvTo) and not issubclass(str, ConvTo):  # rewrite please
 
            conv = obj
 
        elif ConvFrom == BNode and issubclass(BNode, ConvTo):
 
            conv = obj
 
        elif ConvFrom == Literal:
light9/typedgraph_test.py
Show inline comments
 
@@ -49,6 +49,9 @@ class TestTypedValueReturnsBasicTypes:
 
    def test_getsUri(self):
 
        assert typedValue(URIRef, g, subj, L9['uri']) == L9['c']
 

	
 
    def test_getsAsNode(self):
 
        assert typedValue(Node, g, subj, L9['uri']) == L9['c']
 

	
 
    def test_getsBNode(self):
 
        # this is unusual usage since users ought to always be able to replace BNode with URIRef
 
        assert typedValue(BNode, g, subj, L9['bnode']) == g.value(subj,  L9['bnode'])
0 comments (0 inline, 0 general)