Exemple #1
0
def test_parse_data(raw_passports_data):
    passports_data = parse_data(raw_passports_data)
    assert len(passports_data) == 4

    passport = passports_data[0]
    assert passport.get("ecl") == "gry"
    assert passport.get("pid") == "860033327"
    assert passport.get("hcl") == "#fffffd"
def state_3():
    data = """.##.##.
#.#.#.#
##...##
...L...
##...##
#.#.#.#
.##.##."""
    return parse_data(data)
def state_1():
    data = """.......#.
...#.....
.#.......
.........
..#L....#
....#....
.........
#........
...#....."""
    return parse_data(data)
Exemple #4
0
def data_final_state():
    data = """#.#L.L#.##
#LLL#LL.L#
L.#.L..#..
#L##.##.L#
#.#L.LL.LL
#.#L#L#.##
..L.L.....
#L#L##L#L#
#.LLLLLL.L
#.#L#L#.##"""
    return parse_data(data)
Exemple #5
0
def data_next_state():
    data = """#.##.##.##
#######.##
#.#.#..#..
####.##.##
#.##.##.##
#.#####.##
..#.#.....
##########
#.######.#
#.#####.##"""
    return parse_data(data)
def test_create_graph(data):
    data = parse_data(data)
    graph = create_graph(data)
    assert len(graph.nodes) == 9

    node = graph.nodes.get("light-red")
    assert node.color == "light-red"
    assert len(node.children) == 2
    assert node.children[0]["color"] == "bright-white"
    assert node.children[0]["amount"] == 1
    assert node.children[1]["color"] == "muted-yellow"
    assert node.children[1]["amount"] == 2

    node = graph.nodes.get("dotted-black")
    assert len(node.children) == 0
Exemple #7
0
def test_integration(raw_passports_data):
    data = parse_data(raw_passports_data)
    passports = get_passports(data)
    assert len(passports) == 2
def state_2():
    data = """.............
.L.L.#.#.#.#.
............."""
    return parse_data(data)