def test_update_difference_detect(temp): out = StringIO() commands.update('locale', '_build/locale', language=('ja',), out=out) output = out.getvalue() assert output.count('Create:') == 1 assert output.count('Update:') == 0 assert output.count('Not Changed:') == 0 with open('_build/locale/README.pot', 'a') as f: f.write('\nmsgid "test1"\nmsgstr ""\n') out.truncate(0) commands.update('locale', '_build/locale', out=out) output = out.getvalue() assert output.count('Create:') == 0 assert output.count('Update:') == 1 assert output.count('Not Changed:') == 0 with open('_build/locale/README.pot', 'r') as f: d = f.read() d = d.replace('test1', 'test2') with open('_build/locale/README.pot', 'w') as f: f.write(d) out.truncate(0) commands.update('locale', '_build/locale', out=out) output = out.getvalue() assert output.count('Create:') == 0 assert output.count('Update:') == 1 assert output.count('Not Changed:') == 0 out.truncate(0) commands.update('locale', '_build/locale', out=out) output = out.getvalue() assert output.count('Create:') == 0 assert output.count('Update:') == 0 assert output.count('Not Changed:') == 1
def test_update_difference_detect(temp): out = StringIO() commands.update('locale', '_build/locale', language=('ja', ), out=out) output = out.getvalue() assert output.count('Create:') == 1 assert output.count('Update:') == 0 assert output.count('Not Changed:') == 0 with open('_build/locale/README.pot', 'a') as f: f.write('\nmsgid "test1"\nmsgstr ""\n') out.truncate(0) commands.update('locale', '_build/locale', out=out) output = out.getvalue() assert output.count('Create:') == 0 assert output.count('Update:') == 1 assert output.count('Not Changed:') == 0 with open('_build/locale/README.pot', 'r') as f: d = f.read() d = d.replace('test1', 'test2') with open('_build/locale/README.pot', 'w') as f: f.write(d) out.truncate(0) commands.update('locale', '_build/locale', out=out) output = out.getvalue() assert output.count('Create:') == 0 assert output.count('Update:') == 1 assert output.count('Not Changed:') == 0 out.truncate(0) commands.update('locale', '_build/locale', out=out) output = out.getvalue() assert output.count('Create:') == 0 assert output.count('Update:') == 0 assert output.count('Not Changed:') == 1
def test_stat(temp): out = StringIO() commands.update('locale', '_build/locale', language=('ja', ), out=out) commands.stat('locale', out=out) output = out.getvalue() assert 'README.po : 0 translated, 0 fuzzy, 1 untranslated.' in output
def test_update_simple(temp): commands.update('locale', '_build/locale', language=('ja', ))
def test_update_no_language(temp): commands.update('locale', '_build/locale')
def test_update_pot_notfound(temp): commands.update('locale')
def test_stat(temp): out = StringIO() commands.update('locale', '_build/locale', language=('ja',), out=out) commands.stat('locale', out=out) output = out.getvalue() assert 'README.po : 0 translated, 0 fuzzy, 1 untranslated.' in output
def test_update_simple(temp): commands.update('locale', '_build/locale', language=('ja',))