File: validate_test.py

package info (click to toggle)
python-wn 0.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,184 kB
  • sloc: python: 7,592; xml: 493; sql: 220; makefile: 12
file content (24 lines) | stat: -rw-r--r-- 587 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import pytest

from wn import lmf
from wn.validate import validate

tests = [
    ("E101", 0),
    ("E101", 1),
    ("E101", 2),
    ("E101", 3),
    ("W305", 0),
    ("W306", 0),
    ("W307", 0),
]
test_ids = [f"{code}-{i}" for code, i in tests]


@pytest.mark.parametrize("code,i", tests, ids=test_ids)
def test_validate(datadir, code: str, i: int) -> None:
    path = datadir / f"{code}-{i}.xml"
    lex = lmf.load(path, progress_handler=None)["lexicons"][0]
    report = validate(lex, select=[code], progress_handler=None)
    print(report)
    assert len(report[code]["items"]) > 0