Ejemplo n.º 1
0
def test_read_data():
    assert read_data("test_solution_01.data") == [
        "mask = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X",
        "mem[8] = 11",
        "mem[7] = 101",
        "mem[8] = 0",
    ]
Ejemplo n.º 2
0
def test_parse_instructions_without_parsed_mask():
    data = read_data("test_solution_01.data")
    assert parse_instructions(data, parsed_mask=False) == [
        ["mask", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X"],
        ["mem", [8, 11]],
        ["mem", [7, 101]],
        ["mem", [8, 0]],
    ]
Ejemplo n.º 3
0
def test_parse_instructions_with_parsed_mask():
    data = read_data("test_solution_01.data")
    assert parse_instructions(data, parsed_mask=True) == [
        ["mask", {1: 0, 6: 1}],
        ["mem", [8, 11]],
        ["mem", [7, 101]],
        ["mem", [8, 0]],
    ]
Ejemplo n.º 4
0
def test_read_data():
    rules, data = read_data("test_solution_01.data")
    assert rules == {
        0: "4 1 5",
        1: "2 3 | 3 2",
        2: "4 4 | 5 5",
        3: "4 5 | 5 4",
        4: "a",
        5: "b",
    }
    assert data == [
        "ababbb",
        "bababa",
        "abbbab",
        "aaabbb",
        "aaaabbb",
    ]
Ejemplo n.º 5
0
def test_read_data(source, parsed_data):
    assert read_data(source) == parsed_data
Ejemplo n.º 6
0
def test_ticket_scanning_error_rate():
    assert ticket_scanning_error_rate(PARSED_TEST_SOLUTION_01_DATA) == 71
    assert ticket_scanning_error_rate(read_data("test_solution_01.data")) == 71
Ejemplo n.º 7
0
def test_solution_02_check_test_data_expect_false(message):
    rules, _ = read_data("test_solution_02.data")
    r_42 = convert_to_regex(42, rules)
    r_31 = convert_to_regex(31, rules)
    assert solution_02_check(message, r_42, r_31) is False
Ejemplo n.º 8
0
def test_read_data(decks):
    assert read_data("test_solution_01.data") == decks
Ejemplo n.º 9
0
import matplotlib.pyplot as plt

from solution import read_data, plot_temperature_map

dataset = read_data('data')
plot_temperature_map(
    dataset, month=1
)  # plot the temperature over x and y coordinates in February with an optional colourmap
plot_temperature_map(dataset, month=8, cmap='viridis')
plt.show()
Ejemplo n.º 10
0
def test_allergens_to_ingredients(source, result):
    assert allergens_to_ingredients(read_data(source)[0]) == result
Ejemplo n.º 11
0
def test_parse_data(parsed_data):
    assert read_data("test_solution_01.data")[0] == parsed_data
Ejemplo n.º 12
0
def test_read_data():
    assert read_data("test_solution_01.data") == test_solution_01_data
    assert read_data("test_solution_01.data", dimensions=4) == test_solution_02_data
Ejemplo n.º 13
0
import solution

data = solution.read_data()
new_data = solution.transform_data(data)
outputdata = solution.reduce_duplication(new_data)
solution.write_to_csv(outputdata)
Ejemplo n.º 14
0
def test_read_data():
    assert read_data("test_solution_01.data") == (
        939,
        [(0, 7), (1, 13), (4, 59), (6, 31), (7, 19)],
    )
Ejemplo n.º 15
0
def test_read_data():
    assert read_data("test_solution_01.data") == PARSED_TILES