Repository navigation
Expand file tree
/
Copy pathtest_out_param.py
More file actions
84 lines (81 loc) · 2.83 KB
/
Copy pathtest_out_param.py
File metadata and controls
84 lines (81 loc) · 2.83 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
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, out_value",
[
("out_varchar2", "42"),
("out_varchar", "42"),
("out_string", "42"),
("out_number", 42.42),
("out_integer", 42.0),
("out_smallint", 42.0),
("out_real", 42.42),
("out_float", 42.42),
("out_numeric", 42.0),
("out_decimal", 42.0),
("out_binary_integer", 42),
("out_pls_integer", 42),
("out_positive", 42),
("out_natural", 42),
("out_clob", "42"),
("out_long", "42"),
("out_rowid", "AAAACPAABAAAAShAAA"),
("out_date", datetime.datetime(year=2019, month=12, day=20)),
("out_timestamp", datetime.datetime(year=2019, month=12, day=20)),
("out_raw", b"42"),
("out_long_raw", b"42"),
("out_char", "42".ljust(12000, " ")),
("out_character", "42".ljust(12000, " ")),
("out_bool", True),
("out_record", RECORD),
pytest.param(
"ret_record_of_records",
(42, RECORD, RECORD),
marks=pytest.mark.xfail(reason="second record weird offset"),
),
("out_record_of_nested", (42, NESTED, NESTED)),
("out_record_of_plsql_table", (42, PLSQL_TABLE, PLSQL_TABLE),),
("out_nested", NESTED),
("out_nested_of_records", [RECORD] * 10),
("out_nested_of_record_of_nested", [(42, NESTED, NESTED)] * 10),
("out_varray", VARRAY),
("out_plsql_table", PLSQL_TABLE),
("out_plsql_table_of_records", {i: RECORD for i in range(1, 11)}),
pytest.param(
"out_varray_of_plsql_table",
[PLSQL_TABLE] * 10,
marks=pytest.mark.skip("Memory access violation"),
),
pytest.param(
"out_varray_of_nested",
[NESTED] * 10,
marks=pytest.mark.skip("Memory access violation"),
),
pytest.param(
"out_plsql_table_of_nested",
{i: NESTED for i in range(1, 11)},
marks=pytest.mark.skip("Memory access violation"),
),
pytest.param(
"out_nested_of_nested",
[NESTED] * 10,
marks=pytest.mark.skip("Memory access violation"),
),
pytest.param(
"out_nested_of_plsql_table",
[PLSQL_TABLE] * 10,
marks=pytest.mark.skip("Memory access violation"),
),
pytest.param(
"out_plsql_table_of_plsql_table",
{i: PLSQL_TABLE for i in range(1, 11)},
marks=pytest.mark.skip("Memory access violation"),
),
],
)
def test_return_values(plsql, func, out_value):
assert getattr(plsql.test_out_params, func)(None).p_param == out_value