@@ -134,46 +134,40 @@ def test_complex():
134
134
135
135
136
136
def test_insert_longblob ():
137
+ insert_64 = {'id' : 1 , 'data' :
138
+ np .rec .array (
139
+ [[
140
+ (
141
+ np .array ([[np .nan , 1. , 1. , 0. , 1. , 0. , np .nan ]]),
142
+ np .array (['llllrrl' ], dtype = '<U7' ),
143
+ np .array (['ddddddd' ], dtype = '<U7' ),
144
+ np .array (['Stage 10' ], dtype = '<U8' )
145
+ )
146
+ ]],
147
+ dtype = [('hits' , 'O' ), ('sides' , 'O' ), ('tasks' , 'O' ), ('stage' , 'O' )]
148
+ )
149
+ }
150
+ schema .Longblob .insert1 (insert_64 )
151
+ # assert (schema.Longblob & 'id=1').fetch1() == insert_64
152
+ (schema .Longblob & 'id=1' ).delete ()
153
+
137
154
query_32 = ("INSERT INTO djtest_test1.longblob (id, data) VALUES (1, "
138
155
"X'6D596D00530200000001000000010000000400000068697473007369646573007461736B73007374"
139
156
"616765004D000000410200000001000000070000000600000000000000000000000000F8FF00000000"
140
157
"0000F03F000000000000F03F0000000000000000000000000000F03F00000000000000000000000000"
141
158
"00F8FF230000004102000000010000000700000004000000000000006C006C006C006C00720072006C"
142
159
"0023000000410200000001000000070000000400000000000000640064006400640064006400640025"
143
160
"00000041020000000100000008000000040000000000000053007400610067006500200031003000')" )
144
- query_64 = ("INSERT INTO djtest_test1.longblob (id, data) VALUES (2, "
161
+ dj .conn ().query (query_32 ).fetchall ()
162
+ assert (schema .Longblob & 'id=1' ).fetch1 () == insert_64
163
+ (schema .Longblob & 'id=1' ).delete ()
164
+
165
+ query_64 = ("INSERT INTO djtest_test1.longblob (id, data) VALUES (1, "
145
166
"X'646A300002060000000000000004000000000000000A01000104000000000000000A010002040000"
146
167
"00000000000A01000304000000000000000A01000404000000000000000A0100050400000000000000"
147
168
"0A010006')" )
148
- insert_64 = {'id' :3 , 'data' :{
149
- 'stage' : 'Stage 10' ,
150
- 'tasks' : 'ddddddd0' ,
151
- 'sides' : 'llllrrl' ,
152
- 'hits' : [np .nan ,1. ,1. ,0. ,1. ,0. ,np .nan ]
153
- }
154
- }
155
- dj .conn ().query (query_32 ).fetchall ()
169
+
156
170
dj .conn ().query (query_64 ).fetchall ()
157
- schema .Longblob .insert1 (insert_64 )
158
-
159
- query_32_fetch = {'id' : 1 , 'data' :
160
- np .rec .array ([[(
161
- np .array ([[np .nan , 1. , 1. , 0. , 1. , 0. , np .nan ]]),
162
- np .array (['llllrrl' ], dtype = '<U7' ),
163
- np .array (['ddddddd' ], dtype = '<U7' ),
164
- np .array (['Stage 10' ], dtype = '<U8' ))]],
165
- dtype = [('hits' , 'O' ), ('sides' , 'O' ), ('tasks' , 'O' ), ('stage' , 'O' )]
166
- )
167
- }
168
- query_64_fetch = {'id' : 2 , 'data' : [1 , 2 , 3 , 4 , 5 , 6 ]}
169
- insert_64_fetch = {'id' :3 , 'data' :{
170
- 'stage' : 'Stage 10' ,
171
- 'tasks' : 'ddddddd0' ,
172
- 'sides' : 'llllrrl' ,
173
- 'hits' : [np .nan ,1. ,1. ,0. ,1. ,0. ,np .nan ]
174
- }
175
- }
176
-
177
- assert (schema .Longblob & 'id=1' ).fetch1 () == query_32_fetch
178
- assert (schema .Longblob & 'id=2' ).fetch1 () == query_64_fetch
179
- # assert (schema.Longblob & 'id=3').fetch1() == insert_64_fetch fails?????????
171
+ query_64_fetch = {'id' : 1 , 'data' : [1 , 2 , 3 , 4 , 5 , 6 ]}
172
+ assert (schema .Longblob & 'id=1' ).fetch1 () == query_64_fetch
173
+ (schema .Longblob & 'id=1' ).delete ()
0 commit comments