1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 from numpy import int8, int16, int32, int64, float32, float64, zeros
24
25
26 from lib.io import DummyFileObject
27
29 """A class to act as a container."""
30
31 pass
32
33
35 """A dummy function for testing data types."""
36
37 pass
38
40 """A second dummy function for testing data types."""
41
42 return "Hello"
43
44
45
46 DATA_TYPES = []
47 """An array of many different Python objects for testing the correct behaviour of user function args."""
48
49
50
51 DATA_TYPES.append(['bin', 0])
52 DATA_TYPES.append(['bin', 1])
53
54
55 DATA_TYPES.append(['bool', True])
56 DATA_TYPES.append(['bool', False])
57
58
59 DATA_TYPES.append(['class obj', Container()])
60
61
62 DATA_TYPES.append(['class', Container])
63
64
65 DATA_TYPES.append(['dict', {}])
66 DATA_TYPES.append(['dict', {'a': 0, 'b': 1}])
67
68
69 DATA_TYPES.append(['int', 2])
70 DATA_TYPES.append(['int', 10])
71 DATA_TYPES.append(['int', -10])
72
73
74 DATA_TYPES.append(['int', zeros(2, int8)[0]])
75 DATA_TYPES.append(['int', zeros(2, int16)[0]])
76 DATA_TYPES.append(['int', zeros(2, int32)[0]])
77 DATA_TYPES.append(['int', zeros(2, int64)[0]])
78
79
80 DATA_TYPES.append(['file', DummyFileObject()])
81
82
83 DATA_TYPES.append(['float', 0.0])
84 DATA_TYPES.append(['float', 1e-7])
85 DATA_TYPES.append(['float', 1000000.0])
86
87
88 DATA_TYPES.append(['float', zeros(2, float32)[0]])
89 DATA_TYPES.append(['float', zeros(2, float64)[0]])
90
91
92 DATA_TYPES.append(['function', dummy_fn])
93 DATA_TYPES.append(['function', dummy_fn2])
94
95
96 DATA_TYPES.append(['list', []])
97 DATA_TYPES.append(['none list', [None, None]])
98
99
100 DATA_TYPES.append(['int list', [-1, 0, 1]])
101 DATA_TYPES.append(['int list', [zeros(2, int32)[0]]])
102
103
104 DATA_TYPES.append(['float list', [-1., 0., 1.]])
105 DATA_TYPES.append(['float list', [zeros(2, float64)[0]]])
106
107
108 DATA_TYPES.append(['number list', [-1., 0, 1.]])
109
110
111 DATA_TYPES.append(['str list', ['a']])
112 DATA_TYPES.append(['str list', ['a', 'asldfjk']])
113
114
115 DATA_TYPES.append(['None', None])
116
117
118 DATA_TYPES.append(['str', 'a'])
119 DATA_TYPES.append(['str', '10'])
120
121
122 DATA_TYPES.append(['tuple', (None, None)])
123
124
125 DATA_TYPES.append(['float tuple', (0.0,)])
126 DATA_TYPES.append(['float tuple', (0.0, 0.0)])
127 DATA_TYPES.append(['float tuple', (0.0, 0.0, 0.0)])
128 DATA_TYPES.append(['float tuple', (0.0, 0.0, 0.0, 0.0)])
129 DATA_TYPES.append(['float tuple', (0.0, 0.0, 0.0, 0.0, 0.0)])
130 DATA_TYPES.append(['float tuple', (0.0, 0.0, 0.0, 0.0, 0.0, 0.0)])
131 DATA_TYPES.append(['float tuple', (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)])
132
133
134 DATA_TYPES.append(['str tuple', ('a',)])
135 DATA_TYPES.append(['str tuple', ('a', 'b')])
136 DATA_TYPES.append(['str tuple', ('a', 'b', 'c')])
137