예제 #1
0
def test_read_data():
    assert read_data("test_solution_01.data") == [
        "mask = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X",
        "mem[8] = 11",
        "mem[7] = 101",
        "mem[8] = 0",
    ]
예제 #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]],
    ]
예제 #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]],
    ]
예제 #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",
    ]
예제 #5
0
def test_read_data(source, parsed_data):
    assert read_data(source) == parsed_data
예제 #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
예제 #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
예제 #8
0
def test_read_data(decks):
    assert read_data("test_solution_01.data") == decks
예제 #9
0
파일: run.py 프로젝트: tollers/Code-Review
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()
예제 #10
0
def test_allergens_to_ingredients(source, result):
    assert allergens_to_ingredients(read_data(source)[0]) == result
예제 #11
0
def test_parse_data(parsed_data):
    assert read_data("test_solution_01.data")[0] == parsed_data
예제 #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
예제 #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)
예제 #14
0
def test_read_data():
    assert read_data("test_solution_01.data") == (
        939,
        [(0, 7), (1, 13), (4, 59), (6, 31), (7, 19)],
    )
예제 #15
0
def test_read_data():
    assert read_data("test_solution_01.data") == PARSED_TILES