# HG changeset patch # User drewp@bigasterisk.com # Date 1632291719 25200 # Node ID 23beadd3e83a728b01651f74ff1746b6cf7d050d # Parent 2b905c07e82ba2a19d943c533fac9b58a115e29c split a test diff -r 2b905c07e82b -r 23beadd3e83a service/mqtt_to_rdf/inference_test.py --- a/service/mqtt_to_rdf/inference_test.py Tue Sep 21 23:21:38 2021 -0700 +++ b/service/mqtt_to_rdf/inference_test.py Tue Sep 21 23:21:59 2021 -0700 @@ -117,21 +117,30 @@ :new :stmt2 :new . """)) - def testVarLinksTwoStatements(self): - inf = makeInferenceWithRules("{ :a :b ?x . :d :e ?x } => { :new :stmt ?x } .") - implied = inf.infer(N3(":a :b :c .")) - self.assertGraphEqual(implied, N3("")) - implied = inf.infer(N3(":a :b :c . :d :e :f .")) - self.assertGraphEqual(implied, N3("")) - implied = inf.infer(N3(":a :b :c . :d :e :c .")) - self.assertGraphEqual(implied, N3(":new :stmt :c .")) - def testRuleMatchesStaticStatement(self): inf = makeInferenceWithRules("{ :a :b ?x . :a :b :c . } => { :new :stmt ?x } .") implied = inf.infer(N3(":a :b :c .")) self.assertGraphEqual(implied, N3(":new :stmt :c .")) +class TestVarLinksTwoStatements(WithGraphEqual): + + def setUp(self): + self.inf = makeInferenceWithRules("{ :a :b ?x . :d :e ?x } => { :new :stmt ?x } .") + + def testOnlyOneStatementPresent(self): + implied = self.inf.infer(N3(":a :b :c .")) + self.assertGraphEqual(implied, N3("")) + + def testObjectsConflict(self): + implied = self.inf.infer(N3(":a :b :c . :d :e :f .")) + self.assertGraphEqual(implied, N3("")) + + def testObjectsAgree(self): + implied = self.inf.infer(N3(":a :b :c . :d :e :c .")) + self.assertGraphEqual(implied, N3(":new :stmt :c .")) + + class TestBnodeMatching(WithGraphEqual): def testRuleBnodeBindsToInputBnode(self):