~mterry/duplicity/gdrive

« back to all changes in this revision

Viewing changes to testing/unit/test_diffdir.py

  • Committer: Kenneth Loafman
  • Date: 2015-01-31 23:30:49 UTC
  • Revision ID: kenneth@loafman.com-20150131233049-8deeiaxgt0rq2bu6
* Misc fixes for the following PEP8 issues:
  - E231, E241, E251, E261, E262, E271, E272, E301, E302, E303, E502,
    E701, E702, E703, E711, E721, W291, W292, W293, W391
  - see http://pep8.readthedocs.org

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
        blocksize = 32 * 1024
41
41
        while 1:
42
42
            buf = infp.read(blocksize)
43
 
            if not buf: break
 
43
            if not buf:
 
44
                break
44
45
            outfp.write(buf)
45
46
        assert not infp.close()
46
47
        assert not outfp.close()
210
211
            def __init__(self, index, other=None):
211
212
                self.index = index
212
213
                self.other = other
213
 
            def __repr__(self): return "(%s %s)" % (self.index, self.other)
 
214
 
 
215
            def __repr__(self):
 
216
                return "(%s %s)" % (self.index, self.other)
214
217
 
215
218
        def get_iter1():
216
219
            yield Dummy(())
237
240
        assert elem3.index == (1, 5) and elem3.other is None
238
241
        elem4 = result.next()
239
242
        assert elem4.index == (2,) and elem4.other == 1
240
 
        try: elem5 = result.next()
241
 
        except StopIteration: pass
242
 
        else: assert 0, elem5
 
243
        try:
 
244
            elem5 = result.next()
 
245
        except StopIteration:
 
246
            pass
 
247
        else:
 
248
            assert 0, elem5
243
249
 
244
250
 
245
251
def compare_tar(tarfile1, tarfile2):
249
255
    tf2_iter = iter(tf2)
250
256
 
251
257
    for ti1 in tf1:
252
 
        try: ti2 = tf2_iter.next()
 
258
        try:
 
259
            ti2 = tf2_iter.next()
253
260
        except StopIteration:
254
261
            assert 0, ("Premature end to second tarfile, "
255
262
                       "ti1.name = %s" % ti1.name)
263
270
            buf2 = fp2.read()
264
271
            fp2.close()
265
272
            assert buf1 == buf2
266
 
    try: ti2 = tf2_iter.next()
267
 
    except StopIteration: pass
268
 
    else: assert 0, ("Premature end to first tarfile, "
269
 
                     "ti2.name = %s" % ti2.name)
 
273
    try:
 
274
        ti2 = tf2_iter.next()
 
275
    except StopIteration:
 
276
        pass
 
277
    else:
 
278
        assert 0, ("Premature end to first tarfile, "
 
279
                   "ti2.name = %s" % ti2.name)
270
280
 
271
281
    tarfile1.close()
272
282
    tarfile2.close()
273
283
 
 
284
 
274
285
def tarinfo_eq(ti1, ti2):
275
286
    if ti1.name != ti2.name:
276
287
        print "Name:", ti1.name, ti2.name