Code Duplication    Length = 16-18 lines in 2 locations

tests/test_path.py 2 locations

@@ 313-330 (lines=18) @@
310
        _stat = root.utime()
311
        assert abs(_stat.st_atime - t) < 1
312
313
314
def test_chmod():
315
    files = """
316
        a
317
    """
318
    with create_files(files) as _root:
319
        root = path.Path(_root)
320
        (root / 'a').chmod(0o0400)  # only read for only current user
321
        # (root / 'a').chmod(stat.S_IREAD)
322
        if sys.platform == 'win32':
323
            # doesn't appear to be any way for a user to create a file that he
324
            # can't unlink on linux.
325
            with pytest.raises(OSError):
326
                (root / 'a').unlink()
327
        assert root.listdir() == ['a']
328
        (root / 'a').chmod(stat.S_IWRITE)
329
        (root / 'a').unlink()
330
        assert root.listdir() == []
331
332
333
def test_unlink():
@@ 295-310 (lines=16) @@
292
        root = path.Path(_root)
293
        (root / 'foo').renames('bar')
294
        newfiles = [f.relpath(root).replace('\\', '/')
295
                    for f in root.glob('**/*')]
296
        print(newfiles)
297
        assert 'bar/a/b' in newfiles
298
        assert 'bar/a/c' in newfiles
299
        assert 'bar/e/f/g' in newfiles
300
        assert 'bar/d' not in newfiles
301
302
303
def test_utime():
304
    files = """
305
        a
306
    """
307
    with create_files(files) as _root:
308
        root = path.Path(_root)
309
        t = time.time()
310
        _stat = root.utime()
311
        assert abs(_stat.st_atime - t) < 1
312
313