# test expect column values to be of type is not working as expected

**URL:** <https://discourse.getdbt.com/t/test-expect-column-values-to-be-of-type-is-not-working-as-expected/10993>\
**Category:** Help\
**Tags:** testing\
**Created:** [November 30, 2023, 5:55am UTC](https://discourse.getdbt.com/t/test-expect-column-values-to-be-of-type-is-not-working-as-expected/10993 "2023-11-30T05:55:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dhainik](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@Dhainik](https://discourse.getdbt.com/u/Dhainik)\
**Post date:** [November 30, 2023, 5:55am UTC](https://discourse.getdbt.com/t/test-expect-column-values-to-be-of-type-is-not-working-as-expected/10993/1 "2023-11-30T05:55:16Z")

</div>

When working with dbt expectation getting this error:

Compilation Error in test expect\_column\_values\_to\_be\_of\_type\_marketing\_forecast\_date\_\_date (models\sources\spectrum\schema\marketing\_forecast.yml)  
05:46:39 ‘test\_expect\_column\_values\_to\_be\_of\_type’ is undefined. This can happen when calling a macro that does not exist. Check for typos and/or install package dependencies with “dbt deps”.

```auto
# marketing_forecast.sql file
{{ config(materialized = "view") }}

select 
    tentpole,
    to_date(date, 'M/d/yyyy') as date,
    to_date(batch, 'M/d/yyyy') as batch,
    industry,
    cast(leads as integer),
    cast(sqls as integer),
    cast(opportunities as integer),
    cast(demos as integer),
    cast(customers as integer)     
from {{ source('spectrum', 'marketing_forecast') }}

```

```auto
# marketing_forecast.yml file
version: 2

models:
  - name: marketing_forecast
    description: "Marketing forecast data"
    columns:
      - name: tentpole
        tests:
          - accepted_values:
              values: ['POS Nation', 'Rain']
      - name: date
        tests:
          - expect_column_values_to_be_of_type:
              column_type: date

```

```auto
# packages.yml file
packages:
    - package: dbt-labs/dbt_utils
      version: 1.1.1

    - package: dbt-labs/metrics
      version: 1.5.0
    
    - package: calogica/dbt_expectations
      version: 0.10.1
```

---

<div class="post-metadata">

**Author:** ![brunoszdl](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/brunoszdl/32/4113_2.png) [@brunoszdl](https://discourse.getdbt.com/u/brunoszdl)\
**Post date:** [November 30, 2023, 12:49pm UTC](https://discourse.getdbt.com/t/test-expect-column-values-to-be-of-type-is-not-working-as-expected/10993/2 "2023-11-30T12:49:47Z")

</div>

> [@Dhainik](#):
>
> ```auto
> - name: date
> tests:
> - expect_column_values_to_be_of_type:
> column_type: date
> 
> ```

Try specifying the package

```auto
      - name: date
        tests:
          - dbt_expectations.expect_column_values_to_be_of_type:
              column_type: date

```
