File size: 1,232 Bytes
065fee7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import pytest

import redshift_connector
from redshift_connector.utils.oids import RedshiftOID


@pytest.mark.parametrize(
    "error_class",
    (
        "Warning",
        "Error",
        "InterfaceError",
        "DatabaseError",
        "OperationalError",
        "IntegrityError",
        "InternalError",
        "ProgrammingError",
        "NotSupportedError",
        "ArrayContentNotSupportedError",
        "ArrayContentNotHomogenousError",
        "ArrayDimensionsNotConsistentError",
    ),
)
def test_errors_available_on_module(error_class) -> None:
    import importlib

    getattr(importlib.import_module("redshift_connector"), error_class)


def test_cursor_on_module() -> None:
    import importlib

    getattr(importlib.import_module("redshift_connector"), "Cursor")


def test_connection_on_module() -> None:
    import importlib

    getattr(importlib.import_module("redshift_connector"), "Connection")


def test_version_on_module() -> None:
    import importlib

    getattr(importlib.import_module("redshift_connector"), "__version__")


@pytest.mark.parametrize("datatype", [d.name for d in RedshiftOID])
def test_datatypes_on_module(datatype) -> None:
    assert datatype in redshift_connector.__all__