Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 440 lines (361 sloc) 13.608 kb
9685b8a3 »
2012-04-18 add license information
1 #!/usr/bin/env python2
ecd6a52f »
2012-04-25 add unicode keys test
2 # -*- encoding: utf-8 -*-
9685b8a3 »
2012-04-18 add license information
3
9e7e7241 »
2012-04-18 more license stuff
4 # Copyright 2012 Thomas Levine
5
9685b8a3 »
2012-04-18 add license information
6 # This file is part of DumpTruck.
7
8 # DumpTruck is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU Affero Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
12
13 # DumpTruck is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU Affero Public License for more details.
17
18 # You should have received a copy of the GNU Affero Public License
19 # along with DumpTruck. If not, see <http://www.gnu.org/licenses/>.
20
1c902467 »
2012-02-17 invalid params
21 from unittest import TestCase, main
d7b978d6 »
2012-03-26 simplify
22 from json import loads, dumps
0d7d08b4 »
2012-03-27 blarg give up on pickle
23 from dumptruck import DumpTruck, Pickle, quote
c00f6d99 »
2012-02-17 tests
24 import sqlite3
821baa7f »
2012-02-17 clean up after select test
25 import os, shutil
f41cc1c0 »
2012-03-26 quoting
26 import datetime
27
28 class TestQuote(TestCase):
29 def assertQuote(self, textIn, textOut):
30 self.assertEqual(quote(textIn), textOut)
31
32 def test_quote(self):
33 self.assertQuote('a','`a`')
34
35 self.assertQuote('[','`[`')
36 self.assertQuote('`','[`]')
37 self.assertQuote('"','`"`')
38 self.assertQuote('\'','`\'`')
39
9c18a5d1 »
2012-03-26 quoting in insert
40 self.assertQuote('[aoeu]','[aoeu]')
41
f41cc1c0 »
2012-03-26 quoting
42 self.assertQuote('ao 98!?o-_Ho[e&((*^ueu','`ao 98!?o-_Ho[e&((*^ueu`')
43 self.assertQuote('ao 98!?o-_H`oe&((*^ueu','[ao 98!?o-_H`oe&((*^ueu]')
19e6a442 »
2012-03-26 test the readme quote
44 self.assertQuote('no^[hs!\'e]?\'sf_"&\'', '`no^[hs!\'e]?\'sf_"&\'`')
7e07362f »
2012-02-14 tests file
45
612e9f71 »
2012-03-26 test for unquotable
46 class TestQuoteError(TestCase):
47 "Unquotables should raise a particular ValueError."
48 def assertQuoteError(self, textIn):
49 self.assertRaises(ValueError, lambda: quote(textIn))
50
51 def test_quote_error(self):
52 self.assertQuoteError(']`')
53
9f23e673 »
2012-02-17 tests
54 class TestDb(TestCase):
55 def setUp(self):
56 self.cleanUp()
57
58 def tearDown(self):
9e96bbeb »
2012-04-18 clean up after tests
59 #pass
60 self.cleanUp()
9f23e673 »
2012-02-17 tests
61
62 def cleanUp(self):
63 "Clean up temporary files."
c31b6e9c »
2012-03-26 rename to dumptruck
64 for filename in ('test.db', 'dumptruck.db'):
9f23e673 »
2012-02-17 tests
65 try:
66 os.remove(filename)
67 except OSError as e:
821baa7f »
2012-02-17 clean up after select test
68 pass
69 # if (2, 'No such file or directory')!=e:
70 # raise
9f23e673 »
2012-02-17 tests
71
9c18a5d1 »
2012-03-26 quoting in insert
72 #Move this to a ScraperWiki drop-in replacement library.
73 #class TestGetVar(TestDb):
74 # def setUp(self):
75 # self.cleanUp()
c31b6e9c »
2012-03-26 rename to dumptruck
76 # self.h = DumpTruck(dbname = 'fixtures/absa-dumptruckvars.sqlite',vars_table="swvariables")
9c18a5d1 »
2012-03-26 quoting in insert
77 #
78 # def test_existing_var(self):
79 # self.assertEquals(self.h.get_var('DATE'),1329518937.92)
80 #
81 # def test_nonexisting_var(self):
82 # self.assertRaises(NameError,self.h.get_var,'nonexistant_var')
7ab116e6 »
2012-02-17 aoeu
83
0d7d08b4 »
2012-03-27 blarg give up on pickle
84 class SaveGetVar(TestDb):
85 def savegetvar(self, var):
86 h = DumpTruck(dbname = 'test.db')
87 h.save_var("weird", var)
88 self.assertEqual(h.get_var("weird"), var)
89 h.close()
90
91 class TestSaveGetPickle(SaveGetVar):
92 def test_list(self):
93 self.savegetvar(Pickle({30: None}))
94
95 class TestSaveGetList(SaveGetVar):
96 def test_list(self):
97 self.savegetvar([])
98
99 class TestSaveGetDict(SaveGetVar):
100 def test_dict(self):
101 self.savegetvar({})
102
7ab116e6 »
2012-02-17 aoeu
103 class TestSaveVar(TestDb):
86ca9227 »
2012-02-17 aoue
104 def setUp(self):
105 self.cleanUp()
c31b6e9c »
2012-03-26 rename to dumptruck
106 h = DumpTruck(dbname = 'test.db')
825e14a2 »
2012-02-17 save var test
107 h.save_var("birthday","November 30, 1888")
108 h.close()
109 connection=sqlite3.connect('test.db')
86ca9227 »
2012-02-17 aoue
110 self.cursor=connection.cursor()
111
55f38f68 »
2012-02-17 rename to insert and do other stuff
112 def test_insert(self):
dfc7fd9b »
2012-03-27 reuse adapters for save_var
113 self.cursor.execute("SELECT key, value, type FROM `_dumptruckvars`")
86ca9227 »
2012-02-17 aoue
114 observed = self.cursor.fetchall()
dfc7fd9b »
2012-03-27 reuse adapters for save_var
115 expected = [("birthday", "November 30, 1888", "text",)]
825e14a2 »
2012-02-17 save var test
116 self.assertEqual(observed, expected)
a17f015e »
2012-02-17 get_var test
117
86ca9227 »
2012-02-17 aoue
118 def test_has_some_index(self):
119 """
120 PRAGMA index_info(index-name);
121
122 This pragma returns one row each column in the named index. The first column of the result is the rank of the column within the index. The second column of the result is the rank of the column within the table. The third column of output is the name of the column being indexed.
123
124 PRAGMA index_list(table-name);
125
126 This pragma returns one row for each index associated with the given table. Columns of the result set include the index name and a flag to indicate whether or not the index is UNIQUE.
127 """
c31b6e9c »
2012-03-26 rename to dumptruck
128 self.cursor.execute("PRAGMA index_list(_dumptruckvars)")
86ca9227 »
2012-02-17 aoue
129 indices = self.cursor.fetchall()
02953c12 »
2012-02-20 index tests
130 # self.assertNotEqual(indices,[])
131
dfc7fd9b »
2012-03-27 reuse adapters for save_var
132 class DumpTruckVars(TestDb):
d94aae38 »
2012-03-26 saving twice
133 def save(self, key, value):
c31b6e9c »
2012-03-26 rename to dumptruck
134 h = DumpTruck(dbname = 'test.db')
d94aae38 »
2012-03-26 saving twice
135 h.save_var(key, value)
136 h.close()
137
dfc7fd9b »
2012-03-27 reuse adapters for save_var
138 def check(self, key, value, sqltype):
d94aae38 »
2012-03-26 saving twice
139 connection=sqlite3.connect('test.db')
140 self.cursor=connection.cursor()
dfc7fd9b »
2012-03-27 reuse adapters for save_var
141 self.cursor.execute("SELECT key, value, `type` FROM `_dumptruckvars`")
d94aae38 »
2012-03-26 saving twice
142 observed = self.cursor.fetchall()
dfc7fd9b »
2012-03-27 reuse adapters for save_var
143 expected = [(key, value, sqltype)]
d94aae38 »
2012-03-26 saving twice
144 self.assertEqual(observed, expected)
145
146 def get(self, key, value):
c31b6e9c »
2012-03-26 rename to dumptruck
147 h = DumpTruck(dbname = 'test.db')
d94aae38 »
2012-03-26 saving twice
148 self.assertEqual(h.get_var(key), value)
149 h.close()
150
dfc7fd9b »
2012-03-27 reuse adapters for save_var
151 def save_check_get(self, key, value, sqltype):
152 self.save(key, value)
153 self.check(key, value, sqltype)
154 self.get(key, value)
d94aae38 »
2012-03-26 saving twice
155
dfc7fd9b »
2012-03-27 reuse adapters for save_var
156 class TestVarsSQL(DumpTruckVars):
d94aae38 »
2012-03-26 saving twice
157 def test_integer(self):
9c18a5d1 »
2012-03-26 quoting in insert
158 self.save_check_get('foo', 42, 'integer')
d94aae38 »
2012-03-26 saving twice
159
160 #class TestVarsJSON(TestVars):
161 # def test_list(self):
162 # self.save_check_get('foo', [], 'text')
163 # def test_dict(self):
164 # self.save_check_get('foo', {}, 'text')
165
166 #class TestVarsPickle(TestVars):
167 # def test_func(self):
168 # y = lambda x: x^2
169 # self.save_check_get('foo', y, 'blob')
170
c00f6d99 »
2012-02-17 tests
171 class TestSelect(TestDb):
821baa7f »
2012-02-17 clean up after select test
172 def test_select(self):
173 shutil.copy('fixtures/landbank_branches.sqlite','.')
c31b6e9c »
2012-03-26 rename to dumptruck
174 h = DumpTruck(dbname='landbank_branches.sqlite')
821baa7f »
2012-02-17 clean up after select test
175 data_observed = h.execute("SELECT * FROM `branches` WHERE Fax is not null ORDER BY Fax LIMIT 3;")
176 data_expected = [{'town': u'\r\nCenturion', 'date_scraped': 1327791915.618461, 'Fax': u' (012) 312 3647', 'Tel': u' (012) 686 0500', 'address_raw': u'\r\n420 Witch Hazel Ave\n\r\nEcopark\n\r\nCenturion\n\r\n0001\n (012) 686 0500\n (012) 312 3647', 'blockId': 14, 'street-address': None, 'postcode': u'\r\n0001', 'address': u'\r\n420 Witch Hazel Ave\n\r\nEcopark\n\r\nCenturion\n\r\n0001', 'branchName': u'Head Office'}, {'town': u'\r\nCenturion', 'date_scraped': 1327792245.787187, 'Fax': u' (012) 312 3647', 'Tel': u' (012) 686 0500', 'address_raw': u'\r\n420 Witch Hazel Ave\n\r\nEcopark\n\r\nCenturion\n\r\n0001\n (012) 686 0500\n (012) 312 3647', 'blockId': 14, 'street-address': u'\r\n420 Witch Hazel Ave\n\r\nEcopark', 'postcode': u'\r\n0001', 'address': u'\r\n420 Witch Hazel Ave\n\r\nEcopark\n\r\nCenturion\n\r\n0001', 'branchName': u'Head Office'}, {'town': u'\r\nMiddelburg', 'date_scraped': 1327791915.618461, 'Fax': u' (013) 282 6558', 'Tel': u' (013) 283 3500', 'address_raw': u'\r\n184 Jan van Riebeeck Street\n\r\nMiddelburg\n\r\n1050\n (013) 283 3500\n (013) 282 6558', 'blockId': 17, 'street-address': None, 'postcode': u'\r\n1050', 'address': u'\r\n184 Jan van Riebeeck Street\n\r\nMiddelburg\n\r\n1050', 'branchName': u'Middelburg'}]
177 self.assertListEqual(data_observed, data_expected)
178 os.remove('landbank_branches.sqlite')
179
8edc88ee »
2012-02-17 aoue
180 class TestShowTables(TestDb):
181 def test_show_tables(self):
182 shutil.copy('fixtures/landbank_branches.sqlite','test.db')
c31b6e9c »
2012-03-26 rename to dumptruck
183 h = DumpTruck(dbname = 'test.db')
8fd7d3df »
2012-03-26 show_tables -> tables
184 self.assertSetEqual(h.tables(),set(['blocks','branches']))
8edc88ee »
2012-02-17 aoue
185
f9857134 »
2012-03-26 create_table
186 class TestCreateTable(TestDb):
187 def test_create_table(self):
c31b6e9c »
2012-03-26 rename to dumptruck
188 h = DumpTruck(dbname = 'test.db')
f9857134 »
2012-03-26 create_table
189 h.create_table({"foo": 0, "bar": 1, "baz": 2}, 'zombies')
190 h.close()
191
192 connection=sqlite3.connect('test.db')
193 cursor=connection.cursor()
194 cursor.execute("SELECT foo, bar, baz FROM zombies")
195 observed = cursor.fetchall()
196 connection.close()
197
198 expected = []
199 self.assertListEqual(observed, expected)
200
00a8846e »
2012-02-17 yay all tests pass
201 class SaveAndCheck(TestDb):
233248e3 »
2012-03-26 Check for equality of data in and out.
202 def save_and_check(self, dataIn, tableIn, dataOut, tableOut = None, twice = True):
f41cc1c0 »
2012-03-26 quoting
203 if tableOut == None:
204 tableOut = quote(tableIn)
205
233248e3 »
2012-03-26 Check for equality of data in and out.
206 # Insert
c31b6e9c »
2012-03-26 rename to dumptruck
207 h = DumpTruck(dbname = 'test.db')
f41cc1c0 »
2012-03-26 quoting
208 h.insert(dataIn, tableIn)
43247c85 »
2012-02-17 oue
209 h.close()
210
233248e3 »
2012-03-26 Check for equality of data in and out.
211 # Observe with pysqlite
c00f6d99 »
2012-02-17 tests
212 connection=sqlite3.connect('test.db')
213 cursor=connection.cursor()
f41cc1c0 »
2012-03-26 quoting
214 cursor.execute("SELECT * FROM %s" % tableOut)
233248e3 »
2012-03-26 Check for equality of data in and out.
215 observed1 = cursor.fetchall()
c00f6d99 »
2012-02-17 tests
216 connection.close()
217
233248e3 »
2012-03-26 Check for equality of data in and out.
218 if twice:
c31b6e9c »
2012-03-26 rename to dumptruck
219 # Observe with DumpTruck
220 h = DumpTruck(dbname = 'test.db')
233248e3 »
2012-03-26 Check for equality of data in and out.
221 observed2 = h.execute('SELECT * FROM %s' % tableOut)
222 h.close()
223
224 #Check
225 expected1 = dataOut
226 expected2 = [dataIn] if type(dataIn) == dict else dataIn
227
228 self.assertListEqual(observed1, expected1)
229 self.assertListEqual(observed2, expected2)
230
c00f6d99 »
2012-02-17 tests
231
d7b978d6 »
2012-03-26 simplify
232 class TestSaveDict(SaveAndCheck):
233 def test_save_integers(self):
234 d = {1: "A", 2: "B", 3: "C"}
81715b93 »
2012-03-26 error type
235 self.assertRaises(TypeError, lambda: self.save_and_check(
b380edb5 »
2012-03-26 json load and dump
236 {"modelNumber": d}
237 , "model-numbers"
238 , [(dumps(d),)]
239 ))
240
241 def test_save_text(self):
242 d = {'1': 'A', '2': 'B', '3': 'C'}
d7b978d6 »
2012-03-26 simplify
243 self.save_and_check(
244 {"modelNumber": d}
245 , "model-numbers"
246 , [(dumps(d),)]
247 )
248
54adcff3 »
2012-03-26 json
249 def test_save_fanciness(self):
250 d = {'1': datetime.datetime(2012, 3, 5)}
251 self.assertRaises(TypeError, lambda: self.save_and_check(
252 {"modelNumber": d}
253 , "model-numbers"
254 , [(dumps(d),)]
255 ))
256
27ae96b0 »
2012-03-26 reduce randomness of tests
257 class SaveAndSelect(TestDb):
258 def save_and_select(self, d):
54adcff3 »
2012-03-26 json
259 dt = DumpTruck()
260 dt.insert({"foo": d})
261
262 observed = dt.dump()[0]['foo']
27ae96b0 »
2012-03-26 reduce randomness of tests
263 self.assertEqual(d, observed)
264
290dfb82 »
2012-03-26 disable bad converter
265 class TestSaveLong1(SaveAndSelect):
266 def test_zeroes(self):
35d8986d »
2012-03-26 big tests
267 self.save_and_select(100000000000000000000000000000000)
268
290dfb82 »
2012-03-26 disable bad converter
269 class TestSaveLong2(SaveAndSelect):
270 def test_e(self):
271 self.save_and_select(1e+32)
272
35d8986d »
2012-03-26 big tests
273 class TestSaveBigFloat(SaveAndSelect):
274 def test_save_bigfloat(self):
275 self.save_and_select(1.29839287397423984729387429837492374e+100)
276
72d001b4 »
2012-03-26 pickle
277 class TestSavePickle(SaveAndSelect):
278 def test_save_pickle(self):
279 import pickle
280 self.save_and_select(pickle.dumps(SaveAndSelect))
281
aa231ae6 »
2012-03-26 remove lambda test
282 #class TestSaveLambda(SaveAndSelect):
283 # def test_save_lambda(self):
284 # self.save_and_select(lambda x: x^2)
72d001b4 »
2012-03-26 pickle
285
27ae96b0 »
2012-03-26 reduce randomness of tests
286 class TestSaveSet(SaveAndSelect):
287 def test_save_set(self):
288 self.save_and_select(set(["A", "B", "C"]))
54adcff3 »
2012-03-26 json
289
48d0912d »
2012-03-26 boolean and datetime
290 class TestSaveBoolean(SaveAndCheck):
291 def test_save_true(self):
292 self.save_and_check(
293 {"a": True}
294 , "a"
295 , [(1,)]
296 )
297
298 def test_save_true(self):
299 self.save_and_check(
300 {"a": False}
301 , "a"
302 , [(0,)]
303 )
304
d7b978d6 »
2012-03-26 simplify
305 class TestSaveList(SaveAndCheck):
306 def test_save_integers(self):
54adcff3 »
2012-03-26 json
307 d = ["A", "B", "C"]
d7b978d6 »
2012-03-26 simplify
308 self.save_and_check(
54adcff3 »
2012-03-26 json
309 {"model-codes": d}
d7b978d6 »
2012-03-26 simplify
310 , "models"
54adcff3 »
2012-03-26 json
311 , [(dumps(d),)]
d7b978d6 »
2012-03-26 simplify
312 )
313
d94aae38 »
2012-03-26 saving twice
314 class TestSaveTwice(SaveAndCheck):
315 def test_save_twice(self):
316 self.save_and_check(
317 {"modelNumber": 293}
318 , "model-numbers"
319 , [(293,)]
320 )
321 self.save_and_check(
322 {"modelNumber": 293}
323 , "model-numbers"
324 , [(293,), (293,)]
233248e3 »
2012-03-26 Check for equality of data in and out.
325 , twice = False
d94aae38 »
2012-03-26 saving twice
326 )
327
00a8846e »
2012-02-17 yay all tests pass
328 class TestSaveInt(SaveAndCheck):
f41cc1c0 »
2012-03-26 quoting
329 def test_save(self):
00a8846e »
2012-02-17 yay all tests pass
330 self.save_and_check(
331 {"modelNumber": 293}
332 , "model-numbers"
924df2a0 »
2012-02-27 aoeu
333 , [(293,)]
bb29e746 »
2012-02-27 aoeu
334 )
335
ecd6a52f »
2012-04-25 add unicode keys test
336 class TestSaveUnicodeKey(SaveAndCheck):
337 def test_save(self):
338 self.save_and_check(
339 {"name": "Super Digger", "payload": 10, "英国": "yes"}
340 , "machines"
341 , [("Super Digger", 10, "yes")]
342 )
343
6d52bce4 »
2012-03-26 brackets
344 class TestSaveWeirdTableName1(SaveAndCheck):
f41cc1c0 »
2012-03-26 quoting
345 def test_save(self):
3046ea83 »
2012-03-25 fixes from scraping Standard Bank
346 self.save_and_check(
6d52bce4 »
2012-03-26 brackets
347 {"modelNumber": 293}
348 , "This should-be a_valid.table+name!?"
3046ea83 »
2012-03-25 fixes from scraping Standard Bank
349 , [(293,)]
350 )
351
6d52bce4 »
2012-03-26 brackets
352 class TestSaveWeirdTableName2(SaveAndCheck):
924df2a0 »
2012-02-27 aoeu
353 def test_save(self):
bb29e746 »
2012-02-27 aoeu
354 self.save_and_check(
27ae96b0 »
2012-03-26 reduce randomness of tests
355 {"lastname":"LeTourneau"}
9c18a5d1 »
2012-03-26 quoting in insert
356 , "`asoeu`"
27ae96b0 »
2012-03-26 reduce randomness of tests
357 , [(u'LeTourneau',)]
9c18a5d1 »
2012-03-26 quoting in insert
358 )
359
360 class TestSaveWeirdTableName3(SaveAndCheck):
361 def test_save(self):
362 self.save_and_check(
27ae96b0 »
2012-03-26 reduce randomness of tests
363 {"lastname":"LeTourneau"}
924df2a0 »
2012-02-27 aoeu
364 , "[asoeu]"
27ae96b0 »
2012-03-26 reduce randomness of tests
365 , [(u'LeTourneau',)]
00a8846e »
2012-02-17 yay all tests pass
366 )
367
27ae96b0 »
2012-03-26 reduce randomness of tests
368 class TestMultipleColumns(SaveAndSelect):
369 def test_save(self):
370 self.save_and_select({"firstname":"Robert","lastname":"LeTourneau"})
371
6d52bce4 »
2012-03-26 brackets
372 class TestSaveHyphen(SaveAndCheck):
373 def test_save_int(self):
374 self.save_and_check(
375 {"model-number": 293}
376 , "model-numbers"
377 , [(293,)]
378 )
379
00a8846e »
2012-02-17 yay all tests pass
380 class TestSaveString(SaveAndCheck):
924df2a0 »
2012-02-27 aoeu
381 def test_save(self):
00a8846e »
2012-02-17 yay all tests pass
382 self.save_and_check(
27ae96b0 »
2012-03-26 reduce randomness of tests
383 {"lastname":"LeTourneau"}
00a8846e »
2012-02-17 yay all tests pass
384 , "diesel-engineers"
27ae96b0 »
2012-03-26 reduce randomness of tests
385 , [(u'LeTourneau',)]
00a8846e »
2012-02-17 yay all tests pass
386 )
387
8c55d9cb »
2012-03-26 fix date and datetime tests
388 class TestSaveDate(SaveAndCheck):
924df2a0 »
2012-02-27 aoeu
389 def test_save(self):
390 self.save_and_check(
391 {"birthday":datetime.datetime.strptime('1990-03-30', '%Y-%m-%d').date()}
392 , "birthdays"
8c55d9cb »
2012-03-26 fix date and datetime tests
393 , [(u'1990-03-30',)]
394 )
395
396 class TestSaveDateTime(SaveAndCheck):
397 def test_save(self):
398 self.save_and_check(
399 {"birthday":datetime.datetime.strptime('1990-03-30', '%Y-%m-%d')}
400 , "birthdays"
d7b978d6 »
2012-03-26 simplify
401 , [(u'1990-03-30 00:00:00',)]
924df2a0 »
2012-02-27 aoeu
402 )
403
c31b6e9c »
2012-03-26 rename to dumptruck
404 class TestInvalidDumpTruckParams(TestDb):
1c902467 »
2012-02-17 invalid params
405 "Invalid parameters should raise appropriate errors."
406
407 def test_auto_commit(self):
408 for value in (None,3,'uaoeu',set([3]),[]):
c31b6e9c »
2012-03-26 rename to dumptruck
409 self.assertRaises(TypeError, DumpTruck, auto_commit = value)
1c902467 »
2012-02-17 invalid params
410
411 def test_dbname(self):
412 for value in (None,3,True,False,set([3]),[]):
c31b6e9c »
2012-03-26 rename to dumptruck
413 self.assertRaises(TypeError, DumpTruck, dbname = value)
34d102a8 »
2012-02-17 oeu
414
415 def test_vars_table_nonstr(self):
14d96ec2 »
2012-02-17 oeu
416 nonstr_values = (
1c902467 »
2012-02-17 invalid params
417 None, 3, True, False, set([3]), []
418 )
14d96ec2 »
2012-02-17 oeu
419 for value in nonstr_values:
c31b6e9c »
2012-03-26 rename to dumptruck
420 self.assertRaises(TypeError, DumpTruck, vars_table = value)
1c902467 »
2012-02-17 invalid params
421
422
c31b6e9c »
2012-03-26 rename to dumptruck
423 class TestDumpTruckParams(TestDb):
d6511222 »
2012-02-17 test
424 def test_params(self):
425 self.assertFalse(os.path.isfile('test.db'))
c31b6e9c »
2012-03-26 rename to dumptruck
426 h = DumpTruck(dbname='test.db',auto_commit=False,vars_table="baz")
d6511222 »
2012-02-17 test
427 self.assertTrue(os.path.isfile('test.db'))
00a8846e »
2012-02-17 yay all tests pass
428 # self.assertEqual(h.auto_commit, False)
429 # self.assertEqual(h.__vars_table, "baz")
9f23e673 »
2012-02-17 tests
430
d6511222 »
2012-02-17 test
431 class TestParamsDefaults(TestDb):
432 def test_params(self):
c31b6e9c »
2012-03-26 rename to dumptruck
433 self.assertFalse(os.path.isfile('dumptruck.db'))
434 h = DumpTruck()
435 self.assertTrue(os.path.isfile('dumptruck.db'))
00a8846e »
2012-02-17 yay all tests pass
436 # self.assertEqual(h.auto_commit, True)
c31b6e9c »
2012-03-26 rename to dumptruck
437 # self.assertEqual(h.__vars_table, "_dumptruckvars")
37148b33 »
2012-02-17 test defaults
438
7e07362f »
2012-02-14 tests file
439 if __name__ == '__main__':
440 main()
Something went wrong with that request. Please try again.