@@ -15,6 +15,11 @@ def test(schema_any):
15
15
yield schema .TTest ()
16
16
17
17
18
+ @pytest .fixture
19
+ def test2 (schema_any ):
20
+ yield schema .TTest2 ()
21
+
22
+
18
23
@pytest .fixture
19
24
def test_extra (schema_any ):
20
25
yield schema .TTestExtra ()
@@ -123,10 +128,10 @@ def test_wrong_insert_type(user):
123
128
user .insert1 (3 )
124
129
125
130
126
- def test_insert_select (subject ):
127
- schema . TTest2 .delete ()
128
- schema . TTest2 .insert (schema .TTest )
129
- assert len (schema . TTest2 () ) == len (schema .TTest ())
131
+ def test_insert_select (subject , test2 ):
132
+ test2 .delete ()
133
+ test2 .insert (schema .TTest )
134
+ assert len (test2 ) == len (schema .TTest ())
130
135
131
136
original_length = len (subject )
132
137
elements = subject .proj (..., s = "subject_id" )
@@ -141,31 +146,31 @@ def test_insert_select(subject):
141
146
assert len (subject ) == 2 * original_length
142
147
143
148
144
- def test_insert_pandas_roundtrip (schema_any ):
149
+ def test_insert_pandas_roundtrip (test2 ):
145
150
"""ensure fetched frames can be inserted"""
146
- schema . TTest2 .delete ()
151
+ test2 .delete ()
147
152
n = len (schema .TTest ())
148
153
assert n > 0
149
154
df = schema .TTest .fetch (format = "frame" )
150
155
assert isinstance (df , pandas .DataFrame )
151
156
assert len (df ) == n
152
- schema . TTest2 .insert (df )
153
- assert len (schema . TTest2 () ) == n
157
+ test2 .insert (df )
158
+ assert len (test2 ) == n
154
159
155
160
156
- def test_insert_pandas_userframe (schema_any ):
161
+ def test_insert_pandas_userframe (test2 ):
157
162
"""
158
163
ensure simple user-created frames (1 field, non-custom index)
159
164
can be inserted without extra index adjustment
160
165
"""
161
- schema . TTest2 .delete ()
166
+ test2 .delete ()
162
167
n = len (schema .TTest ())
163
168
assert n > 0
164
169
df = pandas .DataFrame (schema .TTest .fetch ())
165
170
assert isinstance (df , pandas .DataFrame )
166
171
assert len (df ) == n
167
- schema . TTest2 .insert (df )
168
- assert len (schema . TTest2 () ) == n
172
+ test2 .insert (df )
173
+ assert len (test2 ) == n
169
174
170
175
171
176
def test_insert_select_ignore_extra_fields0 (test , test_extra ):
0 commit comments