def test_build_onclause_3(self): """Verify build_onclause() builds onclause with conserved direction. build_onclause() should build form primary key to foreign key. """ onclause = querying.build_onclause(self.graph, "phage", "gene") self.assertEqual(onclause.left.table, self.phage) self.assertEqual(onclause.right.table, self.gene)
def test_build_onclause_2(self): """Verify build_onclause() detects table redundencies """ graph = querying.build_graph(self.metadata) table = querying.build_onclause(graph, "phage", "phage") self.assertEqual(table, self.phage)
def test_build_onclause_1(self, TranslateTable): TranslateTable.return_value = "phage" graph = querying.build_graph(self.metadata) table = querying.build_onclause(graph, "phage", "phage") TranslateTable.assert_called_with(self.metadata, "phage") self.assertEqual(table, self.phage)
def test_build_onclause_1(self, translate_table_mock): """Verify translate_table() is called with the correct parameters. """ translate_table_mock.return_value = "phage" graph = querying.build_graph(self.metadata) table = querying.build_onclause(graph, "phage", "phage") translate_table_mock.assert_called_with(self.metadata, "phage")
def test_build_onclause_4(self): """Verify build_onclause() raises KeyError when Tables are not linked. """ with self.assertRaises(KeyError): querying.build_onclause(self.graph, "gene", "trna")
def test_build_onclause_1(self): """Verify build_onclause() returns a BinaryExpression object. """ onclause = querying.build_onclause(self.graph, "gene", "phage") self.assertTrue(isinstance(onclause, BinaryExpression))
def test_build_onclause_2(self): graph = querying.build_graph(self.metadata) querying.build_onclause(graph, "phage", "gene")