Exemplo n.º 1
0
    def test_asterisk_in_pair(self):
        language = "pes"
        links_1 = [lk for lk in tatoeba.links("*", language)]
        links_2 = [lk for lk in tatoeba.links(language, "*")]
        all_links = [lk for lk in tatoeba.links("*", "*")]

        assert len(links_1) == len(links_2)
        assert len(links_1) < len(all_links)
Exemplo n.º 2
0
    def test_asterisk_in_pair(self, languages):
        lg = random.choice(languages)
        links_1 = []
        links_2 = []
        while not links_1:
            links_1 = [lk for lk in tatoeba.links("*", lg)]
            links_2 = [lk for lk in tatoeba.links(lg, "*")]
        all_links = [lk for lk in tatoeba.links("*", "*")]

        assert len(links_1) == len(links_2)
        assert len(links_1) < len(all_links)
Exemplo n.º 3
0
    def test_links(self):
        src_lang, tgt_lang = ("swe", "fra")
        links = [lk for lk in tatoeba.links(src_lang, tgt_lang)]

        assert links
        assert all(isinstance(lk.sentence_id, int) for lk in links)
        assert all(isinstance(lk.translation_id, int) for lk in links)
Exemplo n.º 4
0
    def test_links(self, tables, languages):
        links = []
        while not links:
            src_lg = random.choice(languages)
            tgt_lg = random.choice(languages)
            links = [lk for lk in tatoeba.links(src_lg, tgt_lg)]

        assert all(isinstance(lk.sentence_id, int) for lk in links)
        assert all(isinstance(lk.translation_id, int) for lk in links)
Exemplo n.º 5
0
 def test_wrong_language_pair(self):
     with pytest.raises(NotLanguagePair):
         [s for s in tatoeba.links("foo", "bar")]
Exemplo n.º 6
0
 def test_asterisk_pair(self):
     assert [lk for lk in tatoeba.links("*", "*")]