Code Duplication    Length = 12-14 lines in 2 locations

tests/test_storage.py 2 locations

@@ 375-388 (lines=14) @@
372
def test_save_no_name(sess, tmpdir, monkeypatch):
373
    monkeypatch.setattr(plugin, '__version__', '2.5.0')
374
    sess.save = True
375
    sess.autosave = True
376
    sess.json = None
377
    sess.save_data = False
378
    sess.storage.path = Path(str(tmpdir))
379
    sess.handle_saving()
380
    files = list(Path(str(tmpdir)).rglob('*.json'))
381
    assert len(files) == 1
382
    assert json.load(files[0].open('rU')) == JSON_DATA
383
384
385
@freeze_time("2015-08-15T00:04:18.687119")
386
def test_save_with_error(sess, tmpdir, monkeypatch):
387
    monkeypatch.setattr(plugin, '__version__', '2.5.0')
388
    sess.save = True
389
    sess.autosave = True
390
    sess.json = None
391
    sess.save_data = False
@@ 347-358 (lines=12) @@
344
@freeze_time("2015-08-15T00:04:18.687119")
345
def test_save_json(sess, tmpdir, monkeypatch):
346
    monkeypatch.setattr(plugin, '__version__', '2.5.0')
347
    sess.save = False
348
    sess.autosave = False
349
    sess.json = LooseFileLike()
350
    sess.save_data = False
351
    sess.handle_saving()
352
    assert tmpdir.listdir() == []
353
    assert json.loads(sess.json.getvalue().decode()) == JSON_DATA
354
355
356
@freeze_time("2015-08-15T00:04:18.687119")
357
def test_save_with_name(sess, tmpdir, monkeypatch):
358
    monkeypatch.setattr(plugin, '__version__', '2.5.0')
359
    sess.save = 'foobar'
360
    sess.autosave = True
361
    sess.json = None