Example #1
0
    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)
Example #2
0
    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)
Example #3
0
    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)
Example #4
0
    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")
Example #5
0
 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")
Example #6
0
    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))
Example #7
0
    def test_build_onclause_2(self):
        graph = querying.build_graph(self.metadata)

        querying.build_onclause(graph, "phage", "gene")