Repository navigation
Expand file tree
/
Copy pathtest_return_values.py
More file actions
86 lines (82 loc) · 2.85 KB
/
Copy pathtest_return_values.py
File metadata and controls
86 lines (82 loc) · 2.85 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import pytest
import datetime
RECORD = (42, 84, 126)
VARRAY = list(range(10, 0, -1))
NESTED = [i * 2 for i in range(1, 11)]
PLSQL_TABLE = {i: i for i in range(1, 11)}
@pytest.mark.parametrize(
"func, expected",
[
("ret_varchar2", "42"),
("ret_varchar", "42"),
("ret_string", "42"),
("ret_number", 42.42),
("ret_integer", 42.0),
("ret_smallint", 42.0),
("ret_real", 42.42),
("ret_float", 42.42),
("ret_numeric", 42.0),
("ret_decimal", 42.0),
("ret_binary_integer", 42),
("ret_pls_integer", 42),
("ret_positive", 42),
("ret_natural", 42),
("ret_clob", "42"),
("ret_long", "42"),
("ret_rowid", "AAAACPAABAAAAShAAA"),
("ret_date", datetime.datetime(year=2019, month=12, day=20)),
("ret_timestamp", datetime.datetime(year=2019, month=12, day=20)),
("ret_raw", b"42"),
("ret_long_raw", b"42"),
("ret_char", "42"),
("ret_character", "42"),
("ret_bool", True),
("ret_record", RECORD),
pytest.param(
"ret_record_of_records",
(42, RECORD, RECORD),
marks=pytest.mark.xfail(reason="second record weird offset"),
),
("ret_record_of_nested", (42, NESTED, NESTED)),
("ret_record_of_plsql_table", (42, PLSQL_TABLE, PLSQL_TABLE),),
("ret_nested", NESTED),
("ret_nested_of_records", [RECORD] * 10),
("ret_nested_of_record_of_nested", [(42, NESTED, NESTED)] * 10),
("ret_varray", VARRAY),
("ret_plsql_table", PLSQL_TABLE),
("ret_plsql_table_of_records", {i: RECORD for i in range(1, 11)}),
pytest.param(
"ret_varray_of_plsql_table",
[PLSQL_TABLE] * 10,
marks=pytest.mark.skip(reason="Memory access violation"),
),
pytest.param(
"ret_varray_of_nested",
[NESTED] * 10,
marks=pytest.mark.skip(reason="Memory access violation"),
),
pytest.param(
"ret_plsql_table_of_nested",
{i: NESTED for i in range(1, 11)},
marks=pytest.mark.skip(reason="Memory access violation"),
),
pytest.param(
"ret_nested_of_nested",
[NESTED] * 10,
marks=pytest.mark.skip(reason="Memory access violation"),
),
pytest.param(
"ret_nested_of_plsql_table",
[PLSQL_TABLE] * 10,
marks=pytest.mark.skip(reason="Memory access violation"),
),
pytest.param(
"ret_plsql_table_of_plsql_table",
{i: PLSQL_TABLE for i in range(1, 11)},
marks=pytest.mark.skip(reason="Memory access violation"),
),
],
)
def test_return_values(plsql, func, expected):
return_value = getattr(plsql.test_return, func)()
assert return_value == expected