spaCy/spacy/tests/regression/test_issue2385.py
Ines Montani 968aff2f6a
Update tests for pytest 4.x (#2965)
<!--- Provide a general summary of your changes in the title. -->

## Description
- [x] Replace marks in params for pytest 4.0 compat ([see here](https://docs.pytest.org/en/latest/deprecations.html#marks-in-pytest-mark-parametrize))
- [x] Un-xfail passing tests (some fixes in a recent update resolved a bunch of issues, but tests were apparently never updated here)

### Types of change
<!-- What type of change does your PR cover? Is it a bug fix, an enhancement
or new feature, or a change to the documentation? -->

## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2018-11-26 18:14:57 +01:00

31 lines
1.0 KiB
Python

# coding: utf-8
import pytest
from ...gold import iob_to_biluo
@pytest.mark.parametrize('tags', [('B-ORG', 'L-ORG'),
('B-PERSON', 'I-PERSON', 'L-PERSON'),
('U-BRAWLER', 'U-BRAWLER')])
def test_issue2385_biluo(tags):
"""already biluo format"""
assert iob_to_biluo(tags) == list(tags)
@pytest.mark.parametrize('tags', [('B-BRAWLER', 'I-BRAWLER', 'I-BRAWLER')])
def test_issue2385_iob_bcharacter(tags):
"""fix bug in labels with a 'b' character"""
assert iob_to_biluo(tags) == ['B-BRAWLER', 'I-BRAWLER', 'L-BRAWLER']
@pytest.mark.parametrize('tags', [('I-ORG', 'I-ORG', 'B-ORG')])
def test_issue2385_iob1(tags):
"""maintain support for iob1 format"""
assert iob_to_biluo(tags) == ['B-ORG', 'L-ORG', 'U-ORG']
@pytest.mark.parametrize('tags', [('B-PERSON', 'I-PERSON', 'B-PERSON')])
def test_issue2385_iob2(tags):
"""maintain support for iob2 format"""
assert iob_to_biluo(tags) == ['B-PERSON', 'L-PERSON', 'U-PERSON']