-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
79 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# coding=utf8 | ||
from __future__ import unicode_literals | ||
|
||
import unittest | ||
|
||
import fluent.syntax.ast as FTL | ||
|
||
from fluent.migrate.errors import NotSupportedError | ||
from fluent.migrate.transforms import Source, COPY, PLURALS, REPLACE | ||
from fluent.migrate.helpers import EXTERNAL_ARGUMENT | ||
|
||
|
||
class TestNotSupportedError(unittest.TestCase): | ||
def test_source(self): | ||
pattern = ('Migrating translations from Fluent files is not supported') | ||
with self.assertRaisesRegexp(NotSupportedError, pattern): | ||
Source('test.ftl', 'foo') | ||
|
||
def test_copy(self): | ||
pattern = ('Migrating translations from Fluent files is not supported') | ||
with self.assertRaisesRegexp(NotSupportedError, pattern): | ||
FTL.Message( | ||
FTL.Identifier('foo'), | ||
value=COPY('test.ftl', 'foo') | ||
) | ||
|
||
def test_plurals(self): | ||
pattern = ('Migrating translations from Fluent files is not supported') | ||
with self.assertRaisesRegexp(NotSupportedError, pattern): | ||
FTL.Message( | ||
FTL.Identifier('delete-all'), | ||
value=PLURALS( | ||
'test.ftl', | ||
'deleteAll', | ||
EXTERNAL_ARGUMENT('num') | ||
) | ||
) | ||
|
||
def test_replace(self): | ||
pattern = ('Migrating translations from Fluent files is not supported') | ||
with self.assertRaisesRegexp(NotSupportedError, pattern): | ||
FTL.Message( | ||
FTL.Identifier(u'hello'), | ||
value=REPLACE( | ||
'test.ftl', | ||
'hello', | ||
{ | ||
'#1': EXTERNAL_ARGUMENT('username') | ||
} | ||
) | ||
) |