@@ -134,7 +134,26 @@ def test_complex():
134
134
135
135
136
136
def test_insert_longblob ():
137
- insert_64 = {'id' : 1 , 'data' :
137
+ insert_dj_blob = {'id' : 1 , 'data' : [1 , 2 , 3 ]}
138
+ schema .Longblob .insert1 (insert_dj_blob )
139
+ assert (schema .Longblob & 'id=1' ).fetch1 () == insert_dj_blob
140
+ (schema .Longblob & 'id=1' ).delete ()
141
+
142
+ query_mym_blob = {'id' : 1 , 'data' : np .array ([1 , 2 , 3 ])}
143
+ schema .Longblob .insert1 (query_mym_blob )
144
+ assert (schema .Longblob & 'id=1' ).fetch1 ()['data' ].all () == query_mym_blob ['data' ].all ()
145
+ (schema .Longblob & 'id=1' ).delete ()
146
+
147
+ query_32_blob = ("INSERT INTO djtest_test1.longblob (id, data) VALUES (1, "
148
+ "X'6D596D00530200000001000000010000000400000068697473007369646573007461736B73007374"
149
+ "616765004D000000410200000001000000070000000600000000000000000000000000F8FF00000000"
150
+ "0000F03F000000000000F03F0000000000000000000000000000F03F00000000000000000000000000"
151
+ "00F8FF230000004102000000010000000700000004000000000000006C006C006C006C00720072006C"
152
+ "0023000000410200000001000000070000000400000000000000640064006400640064006400640025"
153
+ "00000041020000000100000008000000040000000000000053007400610067006500200031003000')" )
154
+ dj .conn ().query (query_32_blob ).fetchall ()
155
+ assert (schema .Longblob & 'id=1' ).fetch1 () == {
156
+ 'id' : 1 , 'data' :
138
157
np .rec .array (
139
158
[[
140
159
(
@@ -147,27 +166,5 @@ def test_insert_longblob():
147
166
dtype = [('hits' , 'O' ), ('sides' , 'O' ), ('tasks' , 'O' ), ('stage' , 'O' )]
148
167
)
149
168
}
150
- schema .Longblob .insert1 (insert_64 )
151
- # assert (schema.Longblob & 'id=1').fetch1() == insert_64
152
169
(schema .Longblob & 'id=1' ).delete ()
153
170
154
- query_32 = ("INSERT INTO djtest_test1.longblob (id, data) VALUES (1, "
155
- "X'6D596D00530200000001000000010000000400000068697473007369646573007461736B73007374"
156
- "616765004D000000410200000001000000070000000600000000000000000000000000F8FF00000000"
157
- "0000F03F000000000000F03F0000000000000000000000000000F03F00000000000000000000000000"
158
- "00F8FF230000004102000000010000000700000004000000000000006C006C006C006C00720072006C"
159
- "0023000000410200000001000000070000000400000000000000640064006400640064006400640025"
160
- "00000041020000000100000008000000040000000000000053007400610067006500200031003000')" )
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, "
166
- "X'646A300002060000000000000004000000000000000A01000104000000000000000A010002040000"
167
- "00000000000A01000304000000000000000A01000404000000000000000A0100050400000000000000"
168
- "0A010006')" )
169
-
170
- dj .conn ().query (query_64 ).fetchall ()
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