How to use the turbodbc.data_types function in turbodbc

To help you get started, we’ve selected a few turbodbc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github blue-yonder / turbodbc / python / turbodbc_test / test_data_types.py View on Github external
import turbodbc.data_types
from turbodbc import STRING, BINARY, NUMBER, DATETIME, ROWID

ALL_TYPE_CODES = [turbodbc.data_types._BOOLEAN_CODE,
                  turbodbc.data_types._INTEGER_CODE,
                  turbodbc.data_types._FLOATING_POINT_CODE,
                  turbodbc.data_types._STRING_CODE,
                  turbodbc.data_types._UNICODE_CODE,
                  turbodbc.data_types._TIMESTAMP_CODE,
                  turbodbc.data_types._DATE_CODE]

ALL_DATA_TYPES = [STRING, BINARY, NUMBER, DATETIME, ROWID]


def test_each_type_code_matches_one_data_type():
    for type_code in ALL_TYPE_CODES:
        matches = [type for type in ALL_DATA_TYPES if type_code == type]
        assert 1 == len(matches)


def test_each_type_code_mismatches_all_but_one_data_type():
    for type_code in ALL_TYPE_CODES:
        mismatches = [type for type in ALL_DATA_TYPES if type_code != type]
        expected = len(ALL_DATA_TYPES) - 1
github blue-yonder / turbodbc / python / turbodbc_test / test_data_types.py View on Github external
import turbodbc.data_types
from turbodbc import STRING, BINARY, NUMBER, DATETIME, ROWID

ALL_TYPE_CODES = [turbodbc.data_types._BOOLEAN_CODE,
                  turbodbc.data_types._INTEGER_CODE,
                  turbodbc.data_types._FLOATING_POINT_CODE,
                  turbodbc.data_types._STRING_CODE,
                  turbodbc.data_types._UNICODE_CODE,
                  turbodbc.data_types._TIMESTAMP_CODE,
                  turbodbc.data_types._DATE_CODE]

ALL_DATA_TYPES = [STRING, BINARY, NUMBER, DATETIME, ROWID]


def test_each_type_code_matches_one_data_type():
    for type_code in ALL_TYPE_CODES:
        matches = [type for type in ALL_DATA_TYPES if type_code == type]
        assert 1 == len(matches)