Beispiel #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))
Beispiel #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))
Beispiel #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')))
Beispiel #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)))
Beispiel #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))
Beispiel #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))
Beispiel #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)))