Mercurial > code > home > repos > homeauto
diff service/mqtt_to_rdf/inference_test.py @ 1672:23beadd3e83a
split a test
author | drewp@bigasterisk.com |
---|---|
date | Tue, 21 Sep 2021 23:21:59 -0700 |
parents | 4fd9fdfcf16a |
children | 80f4e741ca4f |
line wrap: on
line diff
--- 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):