@pytest.mark.parametrize('files, expected', [({}, []), ({'file': ['']}, []), ({'file': []}, []), ({'file1': ['foo\n', 'bar\n'], 'file2': ['baz\n']}, [('file1', 'foo\nbar'), ('file2', 'baz')]), ({'file': ['HOME_URL=example.com\n', 'NAME=FOO']}, [('file', 'NAME=FOO')]), ({'file': ['HOME_URL=example.com']}, []), (None, [])])
def test_release_info(files, expected, caplog, monkeypatch):
 fake = ReleaseInfoFake(files)
 monkeypatch.setattr('qutebrowser.utils.version.glob.glob', fake.glob_fake)
 monkeypatch.setattr(version, 'open', fake.open_fake, raising=False)
 with caplog.at_level(logging.ERROR, 'misc'):
  assert (version._release_info() == expected)
 if (files is None):
  assert (len(caplog.records) == 1)
  assert (caplog.records[0].message == 'Error while reading fake-file.')

@ pytest . mark . parametrize ( 'files, expected' , [ ( { } , [ ] ) , ( { 'file' : [ '' ] } , [ ] ) , ( { 'file' : [ ] } , [ ] ) , ( { 'file1' : [ 'foo\n' , 'bar\n' ] , 'file2' : [ 'baz\n' ] } , [ ( 'file1' , 'foo\nbar' ) , ( 'file2' , 'baz' ) ] ) , ( { 'file' : [ 'HOME_URL=example.com\n' , 'NAME=FOO' ] } , [ ( 'file' , 'NAME=FOO' ) ] ) , ( { 'file' : [ 'HOME_URL=example.com' ] } , [ ] ) , ( None , [ ] ) ] ) def test_release_info ( files , expected , caplog , monkeypatch ) : fake = ReleaseInfoFake ( files ) monkeypatch . setattr ( 'qutebrowser.utils.version.glob.glob' , fake . glob_fake ) monkeypatch . setattr ( version , 'open' , fake . open_fake , raising = False ) with caplog . at_level ( logging . ERROR , 'misc' ) : assert ( version . _release_info ( ) == expected ) if ( files is None ) : assert ( len ( caplog . records ) == 1 ) assert ( caplog . records [ 0 ] . message == 'Error while reading fake-file.' )
test _release_info() .