Commit e496fa75 authored by David Mendez's avatar David Mendez
Browse files

Separator Identifier: Fix case when id placeholder is taken as separator

parent d75f8f97
......@@ -3,7 +3,6 @@ Module that identifies the separator of ids automatically
"""
import re
SAMPLE_MAX_SIZE = 200
ID_PLACEHOLDER = 'I_AM_STILL_ALIVE'
NEW_LINE_NAME = '__NEW_LINE__'
......@@ -84,4 +83,6 @@ def get_separator_from_positive_lookbehind(sample):
start = match.start()
separator = sample[start:]
if separator == ID_PLACEHOLDER:
return ''
return separator
......@@ -116,3 +116,14 @@ class AutomaticSeparatorTest(unittest.TestCase):
separator_got = separator_identifier.get_separator(test_raw_ids, parsed_from)
self.assertEqual(separator_must_be, separator_got, msg='The separator was not identified correctly!')
def test_identifies_separator_9(self):
"""
Test that it identifies the separator correctly when there are no ids at all
"""
test_raw_ids = 'CHEMBL1905569CHEMBL3659411'
parsed_from = 'MOLECULE_CHEMBL_IDS'
separator_must_be = ''
separator_got = separator_identifier.get_separator(test_raw_ids, parsed_from)
self.assertEqual(separator_must_be, separator_got, msg='The separator was not identified correctly!')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment