forked from dbt-labs/dbt-core
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure that numeric precision is included only if not None (dbt-labs#796
) * Ensure that numeric precision is included only if not None * Add unit test for data_type of field with empty numeric precision * Add numeric fields to the schema_tests integration tests
- Loading branch information
Showing
3 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import unittest | ||
|
||
import dbt.schema | ||
|
||
|
||
class TestNumericType(unittest.TestCase): | ||
|
||
def test__numeric_type(self): | ||
col = dbt.schema.Column( | ||
'fieldname', | ||
'numeric', | ||
numeric_size='12,2') | ||
|
||
self.assertEqual(col.data_type, 'numeric(12,2)') | ||
|
||
def test__numeric_type_with_no_precision(self): | ||
# PostgreSQL, at least, will allow empty numeric precision | ||
col = dbt.schema.Column( | ||
'fieldname', | ||
'numeric', | ||
numeric_size=None) | ||
|
||
self.assertEqual(col.data_type, 'numeric') |