Beispiel #1
0
 def test_machine_batch(self):
     add_document()
     unit = self.get_unit()
     machine_translation = WeblateMemory()
     unit.source = "Hello"
     machine_translation.batch_translate([unit])
     self.assertEqual(unit.machinery, {"best": 100, "translation": "Ahoj"})
Beispiel #2
0
 def test_machine(self):
     self.add_document()
     machine_translation = WeblateMemory()
     self.assertEqual(
         machine_translation.translate('cs', 'Hello', MockUnit(), None), [
             {
                 'quality': 100,
                 'service': 'Weblate Translation Memory (test)',
                 'source': 'Hello',
                 'text': 'Ahoj'
             },
         ])
Beispiel #3
0
 def test_machine(self):
     self.add_document()
     machine_translation = WeblateMemory()
     self.assertEqual(
         machine_translation.translate('cs', 'Hello', MockUnit(), None),
         [
             {
                 'quality': 100,
                 'service': 'Weblate Translation Memory (test)',
                 'source': 'Hello',
                 'text': 'Ahoj'
             },
         ]
     )
Beispiel #4
0
 def test_machine(self):
     add_document()
     unit = self.get_unit()
     machine_translation = WeblateMemory()
     self.assertEqual(
         machine_translation.translate(unit, search="Hello"),
         [{
             "quality": 100,
             "service": "Weblate Translation Memory",
             "origin": "File: test",
             "source": "Hello",
             "text": "Ahoj",
         }],
     )
Beispiel #5
0
 def test_machine(self):
     add_document()
     machine_translation = WeblateMemory()
     request = HttpRequest()
     request.user = None
     self.assertEqual(
         machine_translation.translate('cs', 'Hello', MockUnit(), request),
         [
             {
                 'quality': 100,
                 'service': 'Weblate Translation Memory (File: test)',
                 'source': 'Hello',
                 'text': 'Ahoj'
             },
         ])
Beispiel #6
0
 def test_machine(self):
     add_document()
     machine_translation = WeblateMemory()
     request = HttpRequest()
     request.user = None
     self.assertEqual(
         machine_translation.translate('cs', 'Hello', MockUnit(), request),
         [
             {
                 'quality': 100,
                 'service': 'Weblate Translation Memory (File: test)',
                 'source': 'Hello',
                 'text': 'Ahoj'
             },
         ]
     )