Fix tests for Python 2

This commit is contained in:
ines 2018-04-03 18:51:31 +02:00
parent 62b4b527d7
commit 10462816bc
1 changed files with 4 additions and 2 deletions

View File

@ -77,9 +77,10 @@ def test_underscore_raises_for_dup(obj):
{'default': None, 'method': lambda: None}, {'default': None, 'method': lambda: None},
{'getter': True}]) {'getter': True}])
def test_underscore_raises_for_invalid(invalid_kwargs): def test_underscore_raises_for_invalid(invalid_kwargs):
invalid_kwargs['force'] = True
doc = Doc(Vocab(), words=['hello', 'world']) doc = Doc(Vocab(), words=['hello', 'world'])
with pytest.raises(ValueError): with pytest.raises(ValueError):
doc.set_extension('test', **invalid_kwargs, force=True) doc.set_extension('test', **invalid_kwargs)
@pytest.mark.parametrize('valid_kwargs', [ @pytest.mark.parametrize('valid_kwargs', [
@ -89,5 +90,6 @@ def test_underscore_raises_for_invalid(invalid_kwargs):
{'default': None}, {'default': None},
{'method': lambda: None}]) {'method': lambda: None}])
def test_underscore_accepts_valid(valid_kwargs): def test_underscore_accepts_valid(valid_kwargs):
valid_kwargs['force'] = True
doc = Doc(Vocab(), words=['hello', 'world']) doc = Doc(Vocab(), words=['hello', 'world'])
doc.set_extension('test', **valid_kwargs, force=True) doc.set_extension('test', **valid_kwargs)