Пример #1
0
    def test_extract_columns_2(self, extract_column_mock):
        """Verify extract_column() is called with correct parameters. 
        extract_columns() should accept both Column and list parameters.
        """
        querying.extract_columns(self.column)

        extract_column_mock.assert_called_with(self.column, check=None)
Пример #2
0
    def test_extract_columns_1(self):
        """Verify extract_columns() extracts from BooleanClauseLists.
        """
        phageid_clause = (self.PhageID == "Trixie")
        cluster_clause = (self.Cluster == "A")
        phamid_clause = (self.PhamID == 2)

        clauses = [phageid_clause, cluster_clause, phamid_clause]
        and_clauses = and_(*clauses)
        expected_columns = [self.PhageID, self.Cluster, self.PhamID]

        column_output = querying.extract_columns(and_clauses)

        self.assertEqual(expected_columns, column_output)
Пример #3
0
    def test_extract_columns_2(self):
        """Verify extract_columns() extracts layered BooleanClauseList.
        """
        phageid_clause = (self.PhageID == "Trixie")
        cluster_clause = (self.Cluster == "A")
        phamid_clause = (self.PhamID == 2)

        subcluster_clause = (self.Subcluster == "A2")

        clauses = [phageid_clause, cluster_clause, phamid_clause]
        and_clauses = and_(*clauses)
        or_clauses = or_(and_clauses, subcluster_clause)
        expected_columns = [
            self.PhageID, self.Cluster, self.PhamID, self.Subcluster
        ]

        column_output = querying.extract_columns(or_clauses)

        self.assertEqual(expected_columns, column_output)
Пример #4
0
    def test_extract_columns_3(self, ExtractColumn):
        querying.extract_columns(self.column)

        ExtractColumn.assert_called_with(self.column, check=None)
Пример #5
0
    def test_extract_columns_1(self, IsInstance):
        querying.extract_columns(self.columns)

        IsInstance.assert_any_call(self.columns, list)