Exemplo n.º 1
0
    def test_read_lff_error(self):
        _lff = lff("""
Name [acd1234], Name2 [abcd1235]
   Lang [abcd1236][abc]
""")
        with self.assertRaises(ValueError):
            list(read_lff(Level.language, fp=_lff))
Exemplo n.º 2
0
    def test_read_lff_error(self):
        _lff = lff("""
Name [acd1234], Name2 [abcd1235]
   Lang [abcd1236][abc]
""")
        with self.assertRaises(ValueError):
            list(read_lff(Level.language, fp=_lff))
Exemplo n.º 3
0
    def test_read_lff_error(self):
        _lff = """
Name [ac1234]; Name2 [abcd1235]
   Lang [abcd1236]abc
"""
        with self.assertRaises(ValueError):
            list(
                read_lff(self.api, Mock(), {}, Level.language,
                         _lff.split('\n')))
Exemplo n.º 4
0
def test_read_lff_error(tmpdir, mocker):
    lff = tmpdir / 'lff.txt'
    lff.write_text("""
Name [ac1234]; Name2 [abcd1235]
    Lang [abcd1236]abc
""", encoding='utf-8')

    with pytest.raises(ValueError):
        list(read_lff(None, mocker.Mock(), {}, Level.language, str(lff)))
Exemplo n.º 5
0
    def test_read_lff(self):
        _lff = lff("""
Name [abcd1234], Name2 [abcd1235]
   Lang [abcd1236][abc]
""")
        res = list(read_lff(Level.language, fp=_lff))
        self.assertEqual(len(res), 1)
        self.assertEqual(res[0].name, 'Lang')
        self.assertEqual(len(res[0].lineage), 2)
        self.assertEqual(res[0].lineage[0], ('Name', 'abcd1234', Level.family))
Exemplo n.º 6
0
    def test_read_lff(self):
        _lff = lff("""
Name [abcd1234], Name2 [abcd1235]
   Lang [abcd1236][abc]
""")
        res = list(read_lff(Level.language, fp=_lff))
        self.assertEqual(len(res), 1)
        self.assertEqual(res[0].name, 'Lang')
        self.assertEqual(len(res[0].lineage), 2)
        self.assertEqual(res[0].lineage[0], ('Name', 'abcd1234', Level.family))
Exemplo n.º 7
0
def test_read_lff_error(tmpdir, mocker, api_copy):
    lff = tmpdir / 'lff.txt'
    lff.write_text("""
Name [ac1234]; Name2 [abcd1235]
    Lang [abcd1236]abc
""",
                   encoding='utf-8')

    with pytest.raises(ValueError):
        list(
            read_lff(mocker.Mock(languoid_levels=api_copy.languoid_levels),
                     mocker.Mock(), {}, api_copy.languoid_levels.language,
                     str(lff)))