* Py 2/3 compatibility of serialize tests

This commit is contained in:
Matthew Honnibal 2015-07-24 04:51:53 +02:00
parent 0bb839d299
commit 6d0cdb1630
2 changed files with 3 additions and 2 deletions

View File

@ -56,7 +56,7 @@ def test_char_packer(vocab):
bits = BitArray() bits = BitArray()
bits.seek(0) bits.seek(0)
byte_str = b'the dog jumped' byte_str = bytearray(b'the dog jumped')
packer.char_codec.encode(byte_str, bits) packer.char_codec.encode(byte_str, bits)
bits.seek(0) bits.seek(0)
result = [b''] * len(byte_str) result = [b''] * len(byte_str)

View File

@ -3,6 +3,7 @@ from __future__ import unicode_literals
import pytest import pytest
@pytest.mark.models
def test_am_pm(en_nlp): def test_am_pm(en_nlp):
numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'] numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']
variants = ['a.m.', 'am', 'p.m.', 'pm'] variants = ['a.m.', 'am', 'p.m.', 'pm']
@ -14,7 +15,7 @@ def test_am_pm(en_nlp):
tokens = en_nlp(string, merge_mwes=True) tokens = en_nlp(string, merge_mwes=True)
assert tokens[4].orth_ == '%s%s%s' % (num, space, var) assert tokens[4].orth_ == '%s%s%s' % (num, space, var)
ents = list(tokens.ents) ents = list(tokens.ents)
assert len(ents) == 1 assert len(ents) == 1, ents
assert ents[0].label_ == 'TIME', string assert ents[0].label_ == 'TIME', string
if ents[0].start == 4 and ents[0].end == 5: if ents[0].start == 4 and ents[0].end == 5:
assert ents[0].orth_ == '%s%s%s' % (num, space, var) assert ents[0].orth_ == '%s%s%s' % (num, space, var)