Exemple #1
0
    def test_join_pathed_tables_5(self, Join, BuildOnClause):
        Join.return_value = self.center
        BuildOnClause.return_value = "onclause"

        querying.join_pathed_tables(self.graph, self.table_pathing_2)

        BuildOnClause.assert_not_called()
        Join.assert_not_called()
Exemple #2
0
    def test_join_pathed_tables_5(self, join_mock, build_on_clause_mock):
        """Verify join_pathed_tables() recognizes empty pathing.
        """
        join_mock.return_value = self.center
        build_on_clause_mock.return_value = "onclause"

        querying.join_pathed_tables(self.graph, self.table_pathing_2)

        build_on_clause_mock.assert_not_called()
        join_mock.assert_not_called()
Exemple #3
0
    def test_join_pathed_tables_4(self, Join, BuildOnClause):
        Join.return_value = self.center
        BuildOnClause.return_value = "onclause"

        querying.join_pathed_tables(self.graph, self.table_pathing_1)

        BuildOnClause.assert_any_call(self.graph, "table_1", "table_4")
        Join.assert_any_call(self.center,
                             self.table_4,
                             isouter=True,
                             onclause="onclause")
Exemple #4
0
    def test_join_pathed_tables_3(self, join_mock, build_on_clause_mock):
        """Verify join_pathed_tables() recognizes already pathed Tables.
        """
        join_mock.return_value = self.center
        build_on_clause_mock.return_value = "onclause"

        querying.join_pathed_tables(self.graph, self.table_pathing_1)

        build_on_clause_mock.assert_any_call(self.graph, "table_2", "table_3")
        join_mock.assert_any_call(self.center,
                                  self.table_3,
                                  isouter=True,
                                  onclause="onclause")
Exemple #5
0
    def test_join_pathed_tables_1(self, join_mock, build_on_clause_mock):
        """Verify build_onclause() influences join() parameters.
        """
        join_mock.return_value = self.center
        build_on_clause_mock.return_value = "onclause"

        querying.join_pathed_tables(self.graph, self.table_pathing_1)

        build_on_clause_mock.assert_any_call(self.graph, "center", "table_1")
        join_mock.assert_any_call(self.center,
                                  self.table_1,
                                  isouter=True,
                                  onclause="onclause")
Exemple #6
0
    def test_join_pathed_tables_4(self, join_mock, build_on_clause_mock):
        """Verify join_pathed_tables() recognizes different Table connections.
        join_pathed_tables() should recognize connections to non-center Tables.
        """
        join_mock.return_value = self.center
        build_on_clause_mock.return_value = "onclause"

        querying.join_pathed_tables(self.graph, self.table_pathing_1)

        build_on_clause_mock.assert_any_call(self.graph, "table_1", "table_4")
        join_mock.assert_any_call(self.center,
                                  self.table_4,
                                  isouter=True,
                                  onclause="onclause")
Exemple #7
0
    def test_join_pathed_tables_1(self):
        """Verify join_pathed_tables() joins Tables in specified order.
        """
        table_pathing = [self.phage, [["phage", "gene"], ["phage", "trna"]]]

        joined_tables = querying.join_pathed_tables(self.graph, table_pathing)

        last_table = joined_tables.right
        joined_tables = joined_tables.left
        self.assertEqual(last_table, self.trna)

        second_table = joined_tables.right
        first_table = joined_tables.left
        self.assertEqual(second_table, self.gene)

        self.assertEqual(first_table, self.phage)
Exemple #8
0
    def test_join_pathed_tables_2(self):
        """Verify join_pathed_tables() recognizes already pathed Tables.
        """
        table_pathing = [
            self.gene, [["gene", "phage"], ["gene", "phage", "trna"]]
        ]

        joined_tables = querying.join_pathed_tables(self.graph, table_pathing)

        last_table = joined_tables.right
        joined_tables = joined_tables.left
        self.assertEqual(last_table, self.trna)

        second_table = joined_tables.right
        first_table = joined_tables.left
        self.assertEqual(second_table, self.phage)

        self.assertEqual(first_table, self.gene)