forked from dbt-labs/dbt-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_base_column.py
More file actions
37 lines (26 loc) · 908 Bytes
/
test_base_column.py
File metadata and controls
37 lines (26 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import unittest
import decimal
from dbt.adapters.base import Column
class TestStringType(unittest.TestCase):
def test__character_type(self):
col = Column(
'fieldname',
'character',
char_size=10
)
self.assertEqual(col.data_type, 'character varying(10)')
class TestNumericType(unittest.TestCase):
def test__numeric_type(self):
col = Column(
'fieldname',
'numeric',
numeric_precision=decimal.Decimal('12'),
numeric_scale=decimal.Decimal('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 = Column(
'fieldname',
'numeric',
numeric_precision=None)
self.assertEqual(col.data_type, 'numeric')