forked from wikimedia/pywikibot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtitletranslate_tests.py
executable file
·44 lines (35 loc) · 993 Bytes
/
titletranslate_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
"""Tests for titletranslate module."""
#
# (C) Pywikibot team, 2022
#
# Distributed under the terms of the MIT license.
#
from __future__ import annotations
import unittest
from pywikibot.titletranslate import translate
from tests.aspects import TestCase
class TestTitleTranslate(TestCase):
"""Tests for titletranslate module."""
sites = {
'dewikt': {
'family': 'wiktionary',
'code': 'de',
},
'enwiki': {
'family': 'wikipedia',
'code': 'en',
},
'zhwikisource': {
'family': 'wikisource',
'code': 'zh',
},
}
def test_translate(self, key):
"""Test translate method."""
site = self.get_site(key)
result = translate(page=self.get_mainpage(site), auto=False,
hints=['5:', 'nl,en,zh'], site=site)
self.assertLength(result, 6)
if __name__ == '__main__':
unittest.main()