Commit 78e66c90 authored by Michal Čihař's avatar Michal Čihař

Test content based guess from ttkit

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 8af07c50
......@@ -21,6 +21,7 @@
File format specific behavior.
'''
import tempfile
from StringIO import StringIO
from unittest import TestCase
from weblate.trans.formats import (
AutoFormat, PoFormat, AndroidFormat, PropertiesFormat,
......@@ -28,6 +29,7 @@ from weblate.trans.formats import (
FILE_FORMATS,
)
from weblate.trans.tests.utils import get_test_file
from translate.storage.po import pofile
TEST_PO = get_test_file('cs.po')
TEST_JSON = get_test_file('cs.json')
......@@ -69,6 +71,16 @@ class AutoLoadTest(TestCase):
if 'resx' in FILE_FORMATS:
self.single_test(TEST_RESX, RESXFormat)
def test_content(self):
"""Test content based guess from ttkit"""
with open(TEST_PO, 'r') as handle:
data = handle.read()
handle = StringIO(data)
store = AutoFormat.parse(handle)
self.assertIsInstance(store, AutoFormat)
self.assertIsInstance(store.store, pofile)
class AutoFormatTest(TestCase):
FORMAT = AutoFormat
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment