Lowercase format vars. Add Chinese character test

main
dvklopfenstein 6 years ago
parent dccbadaf73
commit 11c74f1ffe

@ -25,7 +25,7 @@ def command(conf, args):
if args.append is None: if args.append is None:
ui.edit_file(notepath, temporary=False) ui.edit_file(notepath, temporary=False)
else: else:
latestnote = '{TXT}\n'.format(TXT=args.append) latestnote = '{txt}\n'.format(txt=args.append)
write_file(notepath, latestnote, 'a') write_file(notepath, latestnote, 'a')
NoteEvent(citekey).send() NoteEvent(citekey).send()
rp.close() rp.close()

@ -34,6 +34,11 @@ class TestNoteAppend(DataCommandTestCase):
self.execute_cmds(cmds) self.execute_cmds(cmds)
note_lines.append('bbb') note_lines.append('bbb')
self.assertFileContentEqual(fin_notes, self._get_note_content(note_lines)) self.assertFileContentEqual(fin_notes, self._get_note_content(note_lines))
# Test adding Chinese characters
cmds = [('pubs note Page99 -a \347\350\346\345')]
self.execute_cmds(cmds)
note_lines.append('\347\350\346\345')
self.assertFileContentEqual(fin_notes, self._get_note_content(note_lines))
# # Test adding Japanese character # # Test adding Japanese character
# cmds = [('pubs note Page99 -a ソ')] # cmds = [('pubs note Page99 -a ソ')]
# self.execute_cmds(cmds) # self.execute_cmds(cmds)
@ -43,7 +48,7 @@ class TestNoteAppend(DataCommandTestCase):
@staticmethod @staticmethod
def _get_note_content(note_lines): def _get_note_content(note_lines):
"""Given a list of note lines, return full note file content""" """Given a list of note lines, return full note file content"""
return '{LINES}\n'.format(LINES='\n'.join(note_lines)) return '{lines}\n'.format(lines='\n'.join(note_lines))
if __name__ == '__main__': if __name__ == '__main__':

Loading…
Cancel
Save