Code Duplication    Length = 12-13 lines in 2 locations

tests/test_storage.py 2 locations

@@ 356-368 (lines=13) @@
353
    sess.save = False
354
    sess.autosave = False
355
    sess.json = LooseFileLike()
356
    sess.save_data = False
357
    sess.handle_saving()
358
    assert tmpdir.listdir() == []
359
    assert json.loads(sess.json.getvalue().decode()) == JSON_DATA
360
361
362
@freeze_time("2015-08-15T00:04:18.687119")
363
def test_save_with_name(sess, tmpdir, monkeypatch):
364
    monkeypatch.setattr(plugin, '__version__', '2.5.0')
365
    sess.save = 'foobar'
366
    sess.autosave = True
367
    sess.json = None
368
    sess.save_data = False
369
    sess.storage.path = Path(str(tmpdir))
370
    sess.handle_saving()
371
    files = list(Path(str(tmpdir)).rglob('*.json'))
@@ 371-382 (lines=12) @@
368
    sess.save_data = False
369
    sess.storage.path = Path(str(tmpdir))
370
    sess.handle_saving()
371
    files = list(Path(str(tmpdir)).rglob('*.json'))
372
    print(files)
373
    assert len(files) == 1
374
    assert json.load(files[0].open('rU')) == JSON_DATA
375
376
377
@freeze_time("2015-08-15T00:04:18.687119")
378
def test_save_no_name(sess, tmpdir, monkeypatch):
379
    monkeypatch.setattr(plugin, '__version__', '2.5.0')
380
    sess.save = True
381
    sess.autosave = True
382
    sess.json = None
383
    sess.save_data = False
384
    sess.storage.path = Path(str(tmpdir))
385
    sess.handle_saving()