Show More
@@ -14,13 +14,13 b' class TestNotebookManager(TestCase):' | |||
|
14 | 14 | def test_nb_dir(self): |
|
15 | 15 | with TemporaryDirectory() as td: |
|
16 | 16 | km = FileNotebookManager(notebook_dir=td) |
|
17 |
self.assertEqual |
|
|
17 | self.assertEqual(km.notebook_dir, td) | |
|
18 | 18 | |
|
19 | 19 | def test_create_nb_dir(self): |
|
20 | 20 | with TemporaryDirectory() as td: |
|
21 | 21 | nbdir = os.path.join(td, 'notebooks') |
|
22 | 22 | km = FileNotebookManager(notebook_dir=nbdir) |
|
23 |
self.assertEqual |
|
|
23 | self.assertEqual(km.notebook_dir, nbdir) | |
|
24 | 24 | |
|
25 | 25 | def test_missing_nb_dir(self): |
|
26 | 26 | with TemporaryDirectory() as td: |
@@ -238,14 +238,14 b' class TestDictBackend(TaskDBTest, TestCase):' | |||
|
238 | 238 | self.db.record_limit = 20 |
|
239 | 239 | self.db.cull_fraction = 0.2 |
|
240 | 240 | self.load_records(20) |
|
241 |
self.assertEqual |
|
|
241 | self.assertEqual(len(self.db.get_history()), 20) | |
|
242 | 242 | self.load_records(1) |
|
243 | 243 | # 0.2 * 20 = 4, 21 - 4 = 17 |
|
244 |
self.assertEqual |
|
|
244 | self.assertEqual(len(self.db.get_history()), 17) | |
|
245 | 245 | self.load_records(3) |
|
246 |
self.assertEqual |
|
|
246 | self.assertEqual(len(self.db.get_history()), 20) | |
|
247 | 247 | self.load_records(1) |
|
248 |
self.assertEqual |
|
|
248 | self.assertEqual(len(self.db.get_history()), 17) | |
|
249 | 249 | |
|
250 | 250 | for i in range(100): |
|
251 | 251 | self.load_records(1) |
@@ -257,12 +257,12 b' class TestDictBackend(TaskDBTest, TestCase):' | |||
|
257 | 257 | self.db.size_limit = 1000 |
|
258 | 258 | self.db.cull_fraction = 0.2 |
|
259 | 259 | self.load_records(100, buffer_size=10) |
|
260 |
self.assertEqual |
|
|
260 | self.assertEqual(len(self.db.get_history()), 100) | |
|
261 | 261 | self.load_records(1, buffer_size=0) |
|
262 |
self.assertEqual |
|
|
262 | self.assertEqual(len(self.db.get_history()), 101) | |
|
263 | 263 | self.load_records(1, buffer_size=1) |
|
264 | 264 | # 0.2 * 100 = 20, 101 - 20 = 81 |
|
265 |
self.assertEqual |
|
|
265 | self.assertEqual(len(self.db.get_history()), 81) | |
|
266 | 266 | |
|
267 | 267 | def test_cull_size_drop(self): |
|
268 | 268 | """dropping records updates tracked buffer size""" |
@@ -270,15 +270,15 b' class TestDictBackend(TaskDBTest, TestCase):' | |||
|
270 | 270 | self.db.size_limit = 1000 |
|
271 | 271 | self.db.cull_fraction = 0.2 |
|
272 | 272 | self.load_records(100, buffer_size=10) |
|
273 |
self.assertEqual |
|
|
273 | self.assertEqual(len(self.db.get_history()), 100) | |
|
274 | 274 | self.db.drop_record(self.db.get_history()[-1]) |
|
275 |
self.assertEqual |
|
|
275 | self.assertEqual(len(self.db.get_history()), 99) | |
|
276 | 276 | self.load_records(1, buffer_size=5) |
|
277 |
self.assertEqual |
|
|
277 | self.assertEqual(len(self.db.get_history()), 100) | |
|
278 | 278 | self.load_records(1, buffer_size=5) |
|
279 |
self.assertEqual |
|
|
279 | self.assertEqual(len(self.db.get_history()), 101) | |
|
280 | 280 | self.load_records(1, buffer_size=1) |
|
281 |
self.assertEqual |
|
|
281 | self.assertEqual(len(self.db.get_history()), 81) | |
|
282 | 282 | |
|
283 | 283 | def test_cull_size_update(self): |
|
284 | 284 | """updating records updates tracked buffer size""" |
@@ -286,12 +286,12 b' class TestDictBackend(TaskDBTest, TestCase):' | |||
|
286 | 286 | self.db.size_limit = 1000 |
|
287 | 287 | self.db.cull_fraction = 0.2 |
|
288 | 288 | self.load_records(100, buffer_size=10) |
|
289 |
self.assertEqual |
|
|
289 | self.assertEqual(len(self.db.get_history()), 100) | |
|
290 | 290 | msg_id = self.db.get_history()[-1] |
|
291 | 291 | self.db.update_record(msg_id, dict(result_buffers = [os.urandom(10)], buffers=[])) |
|
292 |
self.assertEqual |
|
|
292 | self.assertEqual(len(self.db.get_history()), 100) | |
|
293 | 293 | self.db.update_record(msg_id, dict(result_buffers = [os.urandom(11)], buffers=[])) |
|
294 |
self.assertEqual |
|
|
294 | self.assertEqual(len(self.db.get_history()), 79) | |
|
295 | 295 | |
|
296 | 296 | class TestSQLiteBackend(TaskDBTest, TestCase): |
|
297 | 297 |
@@ -605,7 +605,7 b' class TestView(ClusterTestCase, ParametricTestCase):' | |||
|
605 | 605 | view = self.client[-1] |
|
606 | 606 | ar = view.apply_async(bar) |
|
607 | 607 | r = ar.get(10) |
|
608 |
self.assertEqual |
|
|
608 | self.assertEqual(r, 'foo') | |
|
609 | 609 | def test_data_pub_single(self): |
|
610 | 610 | view = self.client[-1] |
|
611 | 611 | ar = view.execute('\n'.join([ |
General Comments 0
You need to be logged in to leave comments.
Login now