Пример #1
0
 def test_no_dedent(self):
     # You can optionally suppress the dedent.
     aqua = 'aardvarks'                          # noqa: F841
     blue = 'badgers'                            # noqa: F841
     cyan = 'cats'                               # noqa: F841
     self.catalog.translation = """\
     These are the $blue
     These are the $cyan
     These are the $aqua
     """
     translator = Translator(self.catalog, dedent=False)
     for line in translator.translate('source string').splitlines():
         self.assertTrue(line[:9], '    These')
Пример #2
0
 def setUp(self):
     self.catalog = Catalog()
     # We need depth=1 because we're calling the translation at the same
     # level as the locals we care about.
     self.translator = Translator(self.catalog, depth=1)