@pytest.mark.parametrize('initial_text, edited_text', [('', 'Hello'), ('Hello', 'World'), ('H\xc3\xa4ll\xc3\xb6 W\xc3\xb6rld', '\xc3\x9cberpr\xc3\xbcfung'), ('\\u2603', '\\u2601')])
def test_modify(editor, initial_text, edited_text):
 editor.edit(initial_text)
 with open(editor._file.name, 'r', encoding='utf-8') as f:
  assert (f.read() == initial_text)
 with open(editor._file.name, 'w', encoding='utf-8') as f:
  f.write(edited_text)
 editor._proc.finished.emit(0, QProcess.NormalExit)
 editor.editing_finished.emit.assert_called_with(edited_text)

@ pytest . mark . parametrize ( 'initial_text, edited_text' , [ ( '' , 'Hello' ) , ( 'Hello' , 'World' ) , ( 'H\xc3\xa4ll\xc3\xb6 W\xc3\xb6rld' , '\xc3\x9cberpr\xc3\xbcfung' ) , ( '\\u2603' , '\\u2601' ) ] ) def test_modify ( editor , initial_text , edited_text ) : editor . edit ( initial_text ) with open ( editor . _file . name , 'r' , encoding = 'utf-8' ) as f : assert ( f . read ( ) == initial_text ) with open ( editor . _file . name , 'w' , encoding = 'utf-8' ) as f : f . write ( edited_text ) editor . _proc . finished . emit ( 0 , QProcess . NormalExit ) editor . editing_finished . emit . assert_called_with ( edited_text )
test if inputs get modified correctly .