[e988c2]: / tests / spec / int_series_ops / test_conversion.py

Download this file

50 lines (40 with data), 786 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
38
39
40
41
42
43
44
45
46
47
48
49
from ..tables import p
title = "Convert an integer value"
table_data = {
p: """
| i1 | f1
--+----+----
1 | 1 | 1.0
2 | 32 | 12.4
3 | 5 | -3.2
4 | | 2.1
""",
}
def test_integer_as_float(spec_test):
spec_test(
table_data,
p.i1.as_float(),
{
1: 1.0,
2: 32.0,
3: 5.0,
4: None,
},
)
def test_integer_as_int(spec_test):
spec_test(
table_data,
p.i1.as_int(),
{
1: 1,
2: 32,
3: 5,
4: None,
},
)
def test_add_int_to_float(spec_test):
spec_test(
table_data,
p.i1 + p.f1.as_int(),
{1: 2, 2: 44, 3: 2, 4: None},
)