def test_visit_select_predicate_should_add_logical_filter( self, mock, mock_lfilter): converter = StatementToPlanConvertor() select_predicate = MagicMock() converter._visit_select_predicate(select_predicate) mock_lfilter.assert_called_with(select_predicate) mock.assert_called_with(select_predicate, converter._column_map) mock_lfilter.return_value.append_child.assert_called() self.assertEqual(mock_lfilter.return_value, converter._plan)
def test_visit_select_should_not_call_visits_for_null_values(self): converter = StatementToPlanConvertor() converter.visit_table_ref = MagicMock() converter._visit_projection = MagicMock() converter._visit_select_predicate = MagicMock() statement = SelectStatement() converter.visit_select(statement) converter.visit_table_ref.assert_not_called() converter._visit_projection.assert_not_called() converter._visit_select_predicate.assert_not_called()
def test_visit_select_should_call_appropriate_visit_methods(self): converter = StatementToPlanConvertor() converter.visit_table_ref = MagicMock() converter._visit_projection = MagicMock() converter._visit_select_predicate = MagicMock() statement = MagicMock() converter.visit_select(statement) converter.visit_table_ref.assert_called_with(statement.from_table) converter._visit_projection.assert_called_with(statement.target_list) converter._visit_select_predicate.assert_called_with( statement.where_clause)