NIHOPA / NLPre

Python library for Natural Language Preprocessing (NLPre)
190 stars 34 forks source link

Parsing fails sometimes #7

Closed thoppe closed 7 years ago

thoppe commented 7 years ago

There is a weird bug that I'm tracking down now, which only shows up occasionally in the new replace_from_dictionary code. That is, running tests gives inconsistent results (sometimes fails, sometimes works). The output from tox with some added debug statements:

replace_from_dict_tests.Replace_From_Dict_Test.hydroxyethylrutoside_test2 ... 

MeSH_Hydroxyethylrutoside is great
0 MeSH_Hydroxyethylrutoside is great
FAIL

======================================================================
FAIL: replace_from_dict_tests.Replace_From_Dict_Test.hydroxyethylrutoside_test2
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/hoppeta/git-repo/NLPre/.tox/py27/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/hoppeta/git-repo/NLPre/tests/replace_from_dict_tests.py", line 30, in hydroxyethylrutoside_test2
    assert_equal(doc_right, doc_new)
AssertionError: 'MeSH_Hydroxyethylrutoside is great' != '0 MeSH_Hydroxyethylrutoside is great'

----------------------------------------------------------------------
Ran 1 test in 0.024s

FAILED (failures=1)
ERROR: InvocationError: '/home/hoppeta/git-repo/NLPre/.tox/py27/bin/nosetests tests/replace_from_dict_tests.py:Replace_From_Dict_Test.hydroxyethylrutoside_test2 -vs'
________________________________________________ summary ________________________________________________
ERROR:   py27: commands failed

It looks like the "0" is not being concatenated into the string.