def test_parse_headers6(): t = BaseTransform() t.header_map = {'A': 'FIRST NAME', 'B': 'LAST NAME'} t.headers = ['A', 'B', 'ADDRESS'] t.valid_headers = ['FIRST NAME', 'LAST NAME', 'SKIP'] t.default_not_found = 'SKIP' assert ['FIRST NAME', 'LAST NAME', 'SKIP'] == t.parse_headers()
def test_get_header_indices(): t = BaseTransform() t.headers = ['A', 'B'] idx = t.get_header_indices(['A', 'B', 'C']) assert 0 == idx['A'] assert 1 == idx['B'] assert idx['C'] is None
def test_parse_headers7(): t = BaseTransform() t.header_map = {'A': 'FIRST NAME', 'Column B': 'LAST NAME', 'C': 'NOTES'} t.headers = ['A', 'Column B', 'C'] t.valid_headers = ['FIRST NAME', 'LAST NAME', 'NOTES'] t.prefixable_headers.append('NOTES') assert ['FIRST NAME', 'LAST NAME', 'NOTES'] == t.parse_headers() assert t.column_mods[2].prefix == 'C: '
def test_get_header_idx(): t = BaseTransform() t.headers = ['A', 'B'] assert 0 == t.get_header_idx('A') assert 1 == t.get_header_idx('B') assert -1 == t.get_header_idx('C')
def test_contains_headers(): t = BaseTransform() t.headers = ['A', 'B'] assert t.contains_headers(['A']) assert t.contains_headers(['B', 'A']) assert not t.contains_headers(['B', 'C'])
def test_parse_headers5(): t = BaseTransform() t.header_map = {'A': 'FIRST NAME', 'B': 'LAST NAME'} t.headers = ['A', 'B', 'ADDRESS'] t.valid_headers = ['FIRST NAME', 'LAST NAME', 'ADDRESS'] assert ['FIRST NAME', 'LAST NAME', 'ADDRESS'] == t.parse_headers()
def test_parse_headers4(): t = BaseTransform() t.header_map = {'A': 'NAME', 'B': 'ADDRESS'} t.headers = [None, 'B'] assert ['', 'ADDRESS'] == t.parse_headers()
def test_parse_headers2(): t = BaseTransform() t.headers = ['A', 'B'] assert ['A', 'B'] == t.parse_headers()