def test_parse_input(): data = parse_input(raw_test_data) assert data == [[5, 4, 8, 3, 1, 4, 3, 2, 2, 3], [2, 7, 4, 5, 8, 5, 4, 7, 1, 1], [5, 2, 6, 4, 5, 5, 6, 1, 7, 3], [6, 1, 4, 1, 3, 3, 6, 1, 4, 6], [6, 3, 5, 7, 3, 8, 5, 4, 7, 8], [4, 1, 6, 7, 5, 2, 4, 6, 4, 5], [2, 1, 7, 6, 8, 4, 1, 7, 2, 1], [6, 8, 8, 2, 8, 8, 1, 1, 3, 4], [4, 8, 4, 6, 8, 4, 8, 5, 5, 4], [5, 2, 8, 3, 7, 5, 1, 5, 2, 6]] data = parse_input(min_raw_test_data) assert data == [[1, 1, 1, 1, 1], [1, 9, 9, 9, 1], [1, 9, 1, 9, 1], [1, 9, 9, 9, 1], [1, 1, 1, 1, 1]]
def test_parse_input(): data = parse_input(raw_test_data) assert data == [[2, 1, 9, 9, 9, 4, 3, 2, 1, 0], [3, 9, 8, 7, 8, 9, 4, 9, 2, 1], [9, 8, 5, 6, 7, 8, 9, 8, 9, 2], [8, 7, 6, 7, 8, 9, 6, 7, 8, 9], [9, 8, 9, 9, 9, 6, 5, 6, 7, 8]]
def test_parse_input(): data = parse_input(raw_test_data_1) expected = get_parsed_test_1() assert data.keys() == expected.keys() for k in data.keys(): assert data[k].symbol == expected[k].symbol assert len(data[k].adjacent_nodes) == len(expected[k].adjacent_nodes) for s in data[k].adjacent_nodes: assert len([ a for a in expected[k].adjacent_nodes if a.symbol == s.symbol ]) == 1
def test_parse_input(): data = parse_input(raw_test_data) assert data == [[1, 1, 6, 3, 7, 5, 1, 7, 4, 2], [1, 3, 8, 1, 3, 7, 3, 6, 7, 2], [2, 1, 3, 6, 5, 1, 1, 3, 2, 8], [3, 6, 9, 4, 9, 3, 1, 5, 6, 9], [7, 4, 6, 3, 4, 1, 7, 1, 1, 1], [1, 3, 1, 9, 1, 2, 8, 1, 3, 7], [1, 3, 5, 9, 9, 1, 2, 4, 2, 1], [3, 1, 2, 5, 4, 2, 1, 6, 3, 9], [1, 2, 9, 3, 1, 3, 8, 5, 2, 1], [2, 3, 1, 1, 9, 4, 4, 5, 8, 1]]
def test_parse_input(): test_data = [ '0,9 -> 5,9', # '8,0 -> 0,8', '9,4 -> 3,4', # '2,2 -> 2,1', # '7,0 -> 7,4', # '6,4 -> 2,0', '0,9 -> 2,9', # '3,4 -> 1,4', # '0,0 -> 8,8', '5,5 -> 8,2' ] data = parse_input(test_data) assert data == [(0, 9, 5, 9), (8, 0, 0, 8), (9, 4, 3, 4), (2, 2, 2, 1), (7, 0, 7, 4), (6, 4, 2, 0), (0, 9, 2, 9), (3, 4, 1, 4), (0, 0, 8, 8), (5, 5, 8, 2)]
def test_parse_input(): data = parse_input(test_data_single_line) assert data[0][0].signals == Token('acedgfb').signals assert data[0][1].signals == Token('cdfbe').signals assert data[0][2].signals == Token('gcdfa').signals assert data[0][3].signals == Token('fbcad').signals assert data[0][4].signals == Token('dab').signals assert data[0][5].signals == Token('cefabd').signals assert data[0][6].signals == Token('cdfgeb').signals assert data[0][7].signals == Token('eafb').signals assert data[0][8].signals == Token('cagedb').signals assert data[0][9].signals == Token('ab').signals assert data[1][0].signals == Token('cdfeb').signals assert data[1][1].signals == Token('fcadb').signals assert data[1][2].signals == Token('cdfeb').signals assert data[1][3].signals == Token('cdbaf').signals
def test_parse_input(): data = parse_input(raw_test_data) assert data == ('NNCB', {'BB': 'N', 'BC': 'B', 'BH': 'H', 'BN': 'B', 'CB': 'H', 'CC': 'N', 'CH': 'B', 'CN': 'C', 'HB': 'C', 'HC': 'B', 'HH': 'N', 'HN': 'C', 'NB': 'B', 'NC': 'B', 'NH': 'C', 'NN': 'C'})
def test_parse_input(): data = parse_input(raw_test_data) assert data == ([[6, 10], [0, 14], [9, 10], [0, 3], [10, 4], [4, 11], [6, 0], [6, 12], [4, 1], [0, 13], [10, 12], [3, 4], [3, 0], [8, 4], [1, 10], [2, 14], [8, 10], [9, 0]], [('y', 7), ('x', 5)])
def test_parse_input(): raw_data = '3,4,3,1,2' data = parse_input(raw_data) assert data == [0, 0, 1, 1, 2, 1, 0, 0, 0, 0]
def test_parse_input(): test_data = "16,1,2,0,4,2,7,1,2,14" data = parse_input(test_data) assert data == [16, 1, 2, 0, 4, 2, 7, 1, 2, 14]