-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
tests.py
36 lines (28 loc) · 1.58 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import unittest
from io import StringIO
from extractors import CandidaturaExtractor
class CandidaturaExtractorTestCase(unittest.TestCase):
def assert_fix_fobj(self, input_str, expected_str):
extractor = CandidaturaExtractor()
result = extractor.fix_fobj(StringIO(input_str))
self.assertEqual(result.read(), expected_str)
def test_fix_line_correct_escape(self):
input_data = '''"83494650853";"SONIA ""MEREU""";"2";"DEFERIDO"'''
expected_data = '''"83494650853";"SONIA ""MEREU""";"2";"DEFERIDO"'''
self.assert_fix_fobj(input_data, expected_data)
def test_fix_line_incorrect_escape(self):
input_data = '''"83494650853";"SONIA "MEREU"";"2";"DEFERIDO"'''
expected_data = '''"83494650853";"SONIA ""MEREU""";"2";"DEFERIDO"'''
self.assert_fix_fobj(input_data, expected_data)
def test_fix_line_incorrect_escape_2(self):
input_data = '''"83494650853";"SONIA MEREU"";"2";"DEFERIDO"'''
expected_data = '''"83494650853";"SONIA MEREU""";"2";"DEFERIDO"'''
self.assert_fix_fobj(input_data, expected_data)
def test_fix_line_incorrect_escape_3(self):
input_data = '''"61937410978";"DAVID ''XIXICO"";"2";"DEFERIDO"'''
expected_data = '''"61937410978";"DAVID ''XIXICO""";"2";"DEFERIDO"'''
self.assert_fix_fobj(input_data, expected_data)
def test_fix_line_incorrect_escape_4(self):
input_data = '''"61937410978";""DAVID XIXICO"";"2";"DEFERIDO"'''
expected_data = '''"61937410978";"""DAVID XIXICO""";"2";"DEFERIDO"'''
self.assert_fix_fobj(input_data, expected_data)