fix test error

This commit is contained in:
PyYoshi 2016-10-17 14:19:56 +09:00
parent 696f9b3449
commit 8ec2ba96b0
2 changed files with 7 additions and 2 deletions

View file

@ -66,7 +66,6 @@ cdef class Detector:
self._detected_charset = '' self._detected_charset = ''
def feed(self, char *msg): def feed(self, char *msg):
# TODO: Support py3k
cdef int length cdef int length
cdef int result cdef int result

View file

@ -1,6 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
# coding: utf-8 # coding: utf-8
import sys
from nose.tools import eq_ from nose.tools import eq_
import cchardet import cchardet
@ -80,6 +82,10 @@ class TestCChardet():
def test_detector_noresult(self): def test_detector_noresult(self):
detector = cchardet.Detector() detector = cchardet.Detector()
detector.feed('0') if sys.version_info[0] < 3:
zero = '0'
else:
zero = b'0'
detector.feed(zero)
eq_(detector.done, False) eq_(detector.done, False)
eq_(detector.result, {'encoding': None, 'confidence': None}) eq_(detector.result, {'encoding': None, 'confidence': None})