Skip to content

Commit

Permalink
Test JSON format
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Mar 4, 2015
1 parent a619033 commit b8ae893
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions weblate/trans/tests/data/cs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"Hello, world!\n": "Ahoj světe!\n",
"Orangutan has %d banana.\n": "",
"Try Weblate at http://demo.weblate.org/!\n": "",
"Thank you for using Weblate.": ""
}
13 changes: 13 additions & 0 deletions weblate/trans/tests/test_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
from unittest import TestCase
from weblate.trans.formats import (
AutoFormat, PoFormat, AndroidFormat, PropertiesFormat,
JSONFormat,
)
from weblate.trans.tests.utils import get_test_file

TEST_PO = get_test_file('cs.po')
TEST_JSON = get_test_file('cs.json')
TEST_PROPERTIES = get_test_file('swing.properties')
TEST_ANDROID = get_test_file('strings.xml')
TEST_POT = get_test_file('hello.pot')
Expand Down Expand Up @@ -96,6 +98,17 @@ class PropertiesFormatTest(AutoFormatTest):
MATCH = '\n'


class JSONFormatTest(AutoFormatTest):
FORMAT = JSONFormat
FILE = TEST_JSON
MIME = 'application/json'
COUNT = 4
EXT = 'json'
MASK = 'json/*.json'
EXPECTED_PATH = 'json/cs_CZ.json'
MATCH = '{}\n'


class AndroidFormatTest(AutoFormatTest):
FORMAT = AndroidFormat
FILE = TEST_ANDROID
Expand Down

0 comments on commit b8ae893

Please sign in to comment.