From 42b2d2cb79fd0949d440c6a8eef073fda4bb7420 Mon Sep 17 00:00:00 2001 From: Ted Cassirer Date: Fri, 1 Dec 2023 17:32:45 +0100 Subject: [PATCH] cleanup --- aoc_cas/aoc2019/day11.py | 2 +- aoc_cas/aoc2019/day21.py | 2 +- aoc_cas/aoc2022/day5.py | 2 +- tests/2019/test_2019_day16.py | 2 +- tests/2019/test_2019_day20.py | 2 +- tests/2019/test_2019_day22.py | 2 +- tests/2019/test_2019_day7.py | 2 +- tests/2020/test_2020_day1.py | 2 +- tests/2020/test_2020_day10.py | 2 +- tests/2020/test_2020_day11.py | 2 +- tests/2020/test_2020_day12.py | 2 +- tests/2020/test_2020_day13.py | 2 +- tests/2020/test_2020_day14.py | 2 +- tests/2020/test_2020_day15.py | 2 +- tests/2020/test_2020_day16.py | 2 +- tests/2020/test_2020_day17.py | 2 +- tests/2020/test_2020_day18.py | 2 +- tests/2020/test_2020_day19.py | 2 +- tests/2020/test_2020_day2.py | 2 +- tests/2020/test_2020_day20.py | 2 +- tests/2020/test_2020_day21.py | 2 +- tests/2020/test_2020_day22.py | 2 +- tests/2020/test_2020_day23.py | 2 +- tests/2020/test_2020_day24.py | 2 +- tests/2020/test_2020_day25.py | 2 +- tests/2020/test_2020_day3.py | 2 +- tests/2020/test_2020_day4.py | 2 +- tests/2020/test_2020_day5.py | 2 +- tests/2020/test_2020_day6.py | 2 +- tests/2020/test_2020_day7.py | 2 +- tests/2020/test_2020_day8.py | 2 +- tests/2020/test_2020_day9.py | 2 +- tests/2021/test_2021_day1.py | 2 +- tests/2021/test_2021_day10.py | 2 +- tests/2021/test_2021_day11.py | 2 +- tests/2021/test_2021_day12.py | 2 +- tests/2021/test_2021_day14.py | 2 +- tests/2021/test_2021_day15.py | 2 +- tests/2021/test_2021_day16.py | 2 +- tests/2021/test_2021_day17.py | 2 +- tests/2021/test_2021_day18.py | 2 +- tests/2021/test_2021_day2.py | 2 +- tests/2021/test_2021_day3.py | 2 +- tests/2021/test_2021_day4.py | 2 +- tests/2021/test_2021_day5.py | 2 +- tests/2021/test_2021_day6.py | 2 +- tests/2021/test_2021_day7.py | 2 +- tests/2021/test_2021_day8.py | 2 +- tests/2021/test_2021_day9.py | 2 +- tests/2022/a.txt | 16 --------- tests/2022/test_2022_day10.py | 2 +- tests/2022/test_2022_day11.py | 2 +- tests/2022/test_2022_day12.py | 2 +- tests/2022/test_2022_day13.py | 2 +- tests/2022/test_2022_day14.py | 2 +- tests/2022/test_2022_day15.py | 2 +- tests/2022/test_2022_day16.py | 2 +- tests/2022/test_2022_day2.py | 2 +- tests/2022/test_2022_day3.py | 2 +- tests/2022/test_2022_day4.py | 2 +- tests/2022/test_2022_day5.py | 2 +- tests/2022/test_2022_day6.py | 2 +- tests/2022/test_2022_day7.py | 2 +- tests/2022/test_2022_day8.py | 2 +- tests/2022/test_2022_day9.py | 2 +- tests/fixtures/2023/{1/b.txt => 1.txt} | 8 ++++- tests/fixtures/2023/1/a.txt | 7 ---- tests/test_examples.py | 47 +++++++++++++------------- 68 files changed, 94 insertions(+), 112 deletions(-) delete mode 100644 tests/2022/a.txt rename tests/fixtures/2023/{1/b.txt => 1.txt} (65%) delete mode 100644 tests/fixtures/2023/1/a.txt diff --git a/aoc_cas/aoc2019/day11.py b/aoc_cas/aoc2019/day11.py index 1c84eae..cff5494 100644 --- a/aoc_cas/aoc2019/day11.py +++ b/aoc_cas/aoc2019/day11.py @@ -1,4 +1,4 @@ -from aoc2019.IntCodeComputer import IntCodeComputerVM +from aoc_cas.aoc2019.IntCodeComputer import IntCodeComputerVM from collections import defaultdict BLACK = 0 diff --git a/aoc_cas/aoc2019/day21.py b/aoc_cas/aoc2019/day21.py index 31f01f3..cc6c818 100644 --- a/aoc_cas/aoc2019/day21.py +++ b/aoc_cas/aoc2019/day21.py @@ -1,4 +1,4 @@ -from aoc2019.IntCodeComputer import IntCodeComputerVM, read_program +from aoc_cas.aoc2019.IntCodeComputer import IntCodeComputerVM, read_program def instructions(*inputs): diff --git a/aoc_cas/aoc2022/day5.py b/aoc_cas/aoc2022/day5.py index e71e0ad..063cf22 100644 --- a/aoc_cas/aoc2022/day5.py +++ b/aoc_cas/aoc2022/day5.py @@ -1,6 +1,6 @@ def parseData(data): stackData, instructionData = data.split("\n\n") - numStacks = (data.index("\n") + 1) // 4 + numStacks = int(stackData.split(" ")[-1]) stacks = [[] for _ in range(numStacks)] instructions = [] diff --git a/tests/2019/test_2019_day16.py b/tests/2019/test_2019_day16.py index 5c87015..2e77185 100644 --- a/tests/2019/test_2019_day16.py +++ b/tests/2019/test_2019_day16.py @@ -1,4 +1,4 @@ -from aoc2019 import day16 as aoc +from aoc_cas.aoc2019 import day16 as aoc def testPart1(): diff --git a/tests/2019/test_2019_day20.py b/tests/2019/test_2019_day20.py index 15862d3..7da72d4 100644 --- a/tests/2019/test_2019_day20.py +++ b/tests/2019/test_2019_day20.py @@ -1,4 +1,4 @@ -from aoc2019 import day20 as aoc +from aoc_cas.aoc2019 import day20 as aoc def testPart1(): diff --git a/tests/2019/test_2019_day22.py b/tests/2019/test_2019_day22.py index c8c4696..90a7937 100644 --- a/tests/2019/test_2019_day22.py +++ b/tests/2019/test_2019_day22.py @@ -1,4 +1,4 @@ -from aoc2019 import day22 as aoc +from aoc_cas.aoc2019 import day22 as aoc def testPart1(): diff --git a/tests/2019/test_2019_day7.py b/tests/2019/test_2019_day7.py index 7234b60..1353f13 100644 --- a/tests/2019/test_2019_day7.py +++ b/tests/2019/test_2019_day7.py @@ -1,4 +1,4 @@ -from aoc2019 import day7 as aoc +from aoc_cas.aoc2019 import day7 as aoc def testPart1(): diff --git a/tests/2020/test_2020_day1.py b/tests/2020/test_2020_day1.py index 963038d..bb548ad 100644 --- a/tests/2020/test_2020_day1.py +++ b/tests/2020/test_2020_day1.py @@ -1,4 +1,4 @@ -import aoc2020.day1 as aoc +import aoc_cas.aoc2020.day1 as aoc testData1 = """ 1721 diff --git a/tests/2020/test_2020_day10.py b/tests/2020/test_2020_day10.py index 79eac30..8579b77 100644 --- a/tests/2020/test_2020_day10.py +++ b/tests/2020/test_2020_day10.py @@ -1,4 +1,4 @@ -from aoc2020 import day10 as aoc +from aoc_cas.aoc2020 import day10 as aoc data = """ diff --git a/tests/2020/test_2020_day11.py b/tests/2020/test_2020_day11.py index f3c2d66..8837592 100644 --- a/tests/2020/test_2020_day11.py +++ b/tests/2020/test_2020_day11.py @@ -1,4 +1,4 @@ -from aoc2020 import day11 as aoc +from aoc_cas.aoc2020 import day11 as aoc data = """ diff --git a/tests/2020/test_2020_day12.py b/tests/2020/test_2020_day12.py index e4cdd54..334881a 100644 --- a/tests/2020/test_2020_day12.py +++ b/tests/2020/test_2020_day12.py @@ -1,4 +1,4 @@ -from aoc2020 import day12 as aoc +from aoc_cas.aoc2020 import day12 as aoc data = """ diff --git a/tests/2020/test_2020_day13.py b/tests/2020/test_2020_day13.py index 320e96e..aa0433e 100644 --- a/tests/2020/test_2020_day13.py +++ b/tests/2020/test_2020_day13.py @@ -1,4 +1,4 @@ -from aoc2020 import day13 as aoc +from aoc_cas.aoc2020 import day13 as aoc data = """ diff --git a/tests/2020/test_2020_day14.py b/tests/2020/test_2020_day14.py index ebcb75c..eff7a9d 100644 --- a/tests/2020/test_2020_day14.py +++ b/tests/2020/test_2020_day14.py @@ -1,4 +1,4 @@ -from aoc2020 import day14 as aoc +from aoc_cas.aoc2020 import day14 as aoc def testPart1(): diff --git a/tests/2020/test_2020_day15.py b/tests/2020/test_2020_day15.py index 407cf20..b294b5d 100644 --- a/tests/2020/test_2020_day15.py +++ b/tests/2020/test_2020_day15.py @@ -1,4 +1,4 @@ -from aoc2020 import day15 as aoc +from aoc_cas.aoc2020 import day15 as aoc import pytest diff --git a/tests/2020/test_2020_day16.py b/tests/2020/test_2020_day16.py index 7dcc721..8352983 100644 --- a/tests/2020/test_2020_day16.py +++ b/tests/2020/test_2020_day16.py @@ -1,4 +1,4 @@ -from aoc2020 import day16 as aoc +from aoc_cas.aoc2020 import day16 as aoc def testPart1(): diff --git a/tests/2020/test_2020_day17.py b/tests/2020/test_2020_day17.py index db95876..0f12186 100644 --- a/tests/2020/test_2020_day17.py +++ b/tests/2020/test_2020_day17.py @@ -1,4 +1,4 @@ -from aoc2020 import day17 as aoc +from aoc_cas.aoc2020 import day17 as aoc data = """ diff --git a/tests/2020/test_2020_day18.py b/tests/2020/test_2020_day18.py index 11603b3..2bae8e8 100644 --- a/tests/2020/test_2020_day18.py +++ b/tests/2020/test_2020_day18.py @@ -1,4 +1,4 @@ -from aoc2020 import day18 as aoc +from aoc_cas.aoc2020 import day18 as aoc def testPart1(): diff --git a/tests/2020/test_2020_day19.py b/tests/2020/test_2020_day19.py index cbb5a55..451e237 100644 --- a/tests/2020/test_2020_day19.py +++ b/tests/2020/test_2020_day19.py @@ -1,4 +1,4 @@ -from aoc2020 import day19 as aoc +from aoc_cas.aoc2020 import day19 as aoc data1 = """ 0: 4 1 5 diff --git a/tests/2020/test_2020_day2.py b/tests/2020/test_2020_day2.py index 9a4d8fb..4a2d3e4 100644 --- a/tests/2020/test_2020_day2.py +++ b/tests/2020/test_2020_day2.py @@ -1,4 +1,4 @@ -import aoc2020.day2 as aoc +import aoc_cas.aoc2020.day2 as aoc testData = """ 1-3 a: abcde diff --git a/tests/2020/test_2020_day20.py b/tests/2020/test_2020_day20.py index 03cf22b..f45c6aa 100644 --- a/tests/2020/test_2020_day20.py +++ b/tests/2020/test_2020_day20.py @@ -1,4 +1,4 @@ -from aoc2020 import day20 as aoc +from aoc_cas.aoc2020 import day20 as aoc def testPart1(): diff --git a/tests/2020/test_2020_day21.py b/tests/2020/test_2020_day21.py index b77a58c..0eec4a9 100644 --- a/tests/2020/test_2020_day21.py +++ b/tests/2020/test_2020_day21.py @@ -1,4 +1,4 @@ -from aoc2020 import day21 as aoc +from aoc_cas.aoc2020 import day21 as aoc data = """ mxmxvkd kfcds sqjhc nhms (contains dairy, fish) diff --git a/tests/2020/test_2020_day22.py b/tests/2020/test_2020_day22.py index ab5a0f1..edfd794 100644 --- a/tests/2020/test_2020_day22.py +++ b/tests/2020/test_2020_day22.py @@ -1,4 +1,4 @@ -from aoc2020 import day22 as aoc +from aoc_cas.aoc2020 import day22 as aoc data = """ Player 1: diff --git a/tests/2020/test_2020_day23.py b/tests/2020/test_2020_day23.py index 69320a7..c975ad7 100644 --- a/tests/2020/test_2020_day23.py +++ b/tests/2020/test_2020_day23.py @@ -1,4 +1,4 @@ -from aoc2020 import day23 as aoc +from aoc_cas.aoc2020 import day23 as aoc import pytest data = "389125467" diff --git a/tests/2020/test_2020_day24.py b/tests/2020/test_2020_day24.py index 9bd6892..48aa936 100644 --- a/tests/2020/test_2020_day24.py +++ b/tests/2020/test_2020_day24.py @@ -1,4 +1,4 @@ -from aoc2020 import day24 as aoc +from aoc_cas.aoc2020 import day24 as aoc data = """ sesenwnenenewseeswwswswwnenewsewsw diff --git a/tests/2020/test_2020_day25.py b/tests/2020/test_2020_day25.py index eb2ca47..9dc3e51 100644 --- a/tests/2020/test_2020_day25.py +++ b/tests/2020/test_2020_day25.py @@ -1,4 +1,4 @@ -from aoc2020 import day25 as aoc +from aoc_cas.aoc2020 import day25 as aoc data = """ 5764801 diff --git a/tests/2020/test_2020_day3.py b/tests/2020/test_2020_day3.py index a9d5a62..9e7c76d 100644 --- a/tests/2020/test_2020_day3.py +++ b/tests/2020/test_2020_day3.py @@ -1,4 +1,4 @@ -import aoc2020.day3 as aoc +import aoc_cas.aoc2020.day3 as aoc testData = """ ..##....... diff --git a/tests/2020/test_2020_day4.py b/tests/2020/test_2020_day4.py index 8e90384..57b2da0 100644 --- a/tests/2020/test_2020_day4.py +++ b/tests/2020/test_2020_day4.py @@ -1,4 +1,4 @@ -import aoc2020.day4 as aoc +import aoc_cas.aoc2020.day4 as aoc testData = """ ecl:gry pid:860033327 eyr:2020 hcl:#fffffd diff --git a/tests/2020/test_2020_day5.py b/tests/2020/test_2020_day5.py index 1808629..bd9a13e 100644 --- a/tests/2020/test_2020_day5.py +++ b/tests/2020/test_2020_day5.py @@ -1,4 +1,4 @@ -import aoc2020.day5 as aoc +import aoc_cas.aoc2020.day5 as aoc def testSeatId(): diff --git a/tests/2020/test_2020_day6.py b/tests/2020/test_2020_day6.py index 69a4e8b..85c50e3 100644 --- a/tests/2020/test_2020_day6.py +++ b/tests/2020/test_2020_day6.py @@ -1,4 +1,4 @@ -from aoc2020 import day6 as aoc +from aoc_cas.aoc2020 import day6 as aoc def testPart1(): diff --git a/tests/2020/test_2020_day7.py b/tests/2020/test_2020_day7.py index 175880d..f7398a8 100644 --- a/tests/2020/test_2020_day7.py +++ b/tests/2020/test_2020_day7.py @@ -1,4 +1,4 @@ -from aoc2020 import day7 as aoc +from aoc_cas.aoc2020 import day7 as aoc def testPart1(): diff --git a/tests/2020/test_2020_day8.py b/tests/2020/test_2020_day8.py index 5247d10..f17592b 100644 --- a/tests/2020/test_2020_day8.py +++ b/tests/2020/test_2020_day8.py @@ -1,4 +1,4 @@ -from aoc2020 import day8 as aoc +from aoc_cas.aoc2020 import day8 as aoc testProgram = """ diff --git a/tests/2020/test_2020_day9.py b/tests/2020/test_2020_day9.py index 994350e..04e811f 100644 --- a/tests/2020/test_2020_day9.py +++ b/tests/2020/test_2020_day9.py @@ -1,4 +1,4 @@ -from aoc2020 import day9 as aoc +from aoc_cas.aoc2020 import day9 as aoc data = """ diff --git a/tests/2021/test_2021_day1.py b/tests/2021/test_2021_day1.py index fd7ebc6..78f8b08 100644 --- a/tests/2021/test_2021_day1.py +++ b/tests/2021/test_2021_day1.py @@ -1,4 +1,4 @@ -import aoc2021.day1 as aoc +import aoc_cas.aoc2021.day1 as aoc testData = """ 199 diff --git a/tests/2021/test_2021_day10.py b/tests/2021/test_2021_day10.py index 18ba988..6ae1920 100644 --- a/tests/2021/test_2021_day10.py +++ b/tests/2021/test_2021_day10.py @@ -1,4 +1,4 @@ -import aoc2021.day10 as aoc +import aoc_cas.aoc2021.day10 as aoc testData = """ [({(<(())[]>[[{[]{<()<>> diff --git a/tests/2021/test_2021_day11.py b/tests/2021/test_2021_day11.py index b816073..e49670b 100644 --- a/tests/2021/test_2021_day11.py +++ b/tests/2021/test_2021_day11.py @@ -1,4 +1,4 @@ -import aoc2021.day11 as aoc +import aoc_cas.aoc2021.day11 as aoc testData = """ 5483143223 diff --git a/tests/2021/test_2021_day12.py b/tests/2021/test_2021_day12.py index 5a15484..b2c9441 100644 --- a/tests/2021/test_2021_day12.py +++ b/tests/2021/test_2021_day12.py @@ -1,4 +1,4 @@ -import aoc2021.day12 as aoc +import aoc_cas.aoc2021.day12 as aoc testData1 = """ start-A diff --git a/tests/2021/test_2021_day14.py b/tests/2021/test_2021_day14.py index 4040320..a504a9f 100644 --- a/tests/2021/test_2021_day14.py +++ b/tests/2021/test_2021_day14.py @@ -1,4 +1,4 @@ -import aoc2021.day14 as aoc +import aoc_cas.aoc2021.day14 as aoc testData = """ NNCB diff --git a/tests/2021/test_2021_day15.py b/tests/2021/test_2021_day15.py index b8fed63..015ce3c 100644 --- a/tests/2021/test_2021_day15.py +++ b/tests/2021/test_2021_day15.py @@ -1,4 +1,4 @@ -import aoc2021.day15 as aoc +import aoc_cas.aoc2021.day15 as aoc testData = """ 1163751742 diff --git a/tests/2021/test_2021_day16.py b/tests/2021/test_2021_day16.py index 01dc176..204aab2 100644 --- a/tests/2021/test_2021_day16.py +++ b/tests/2021/test_2021_day16.py @@ -1,4 +1,4 @@ -import aoc2021.day16 as aoc +import aoc_cas.aoc2021.day16 as aoc def testPart1(): diff --git a/tests/2021/test_2021_day17.py b/tests/2021/test_2021_day17.py index 8aeb35e..5bb92ba 100644 --- a/tests/2021/test_2021_day17.py +++ b/tests/2021/test_2021_day17.py @@ -1,4 +1,4 @@ -import aoc2021.day17 as aoc +import aoc_cas.aoc2021.day17 as aoc def testPart1(): diff --git a/tests/2021/test_2021_day18.py b/tests/2021/test_2021_day18.py index b7a1305..caae159 100644 --- a/tests/2021/test_2021_day18.py +++ b/tests/2021/test_2021_day18.py @@ -1,4 +1,4 @@ -import aoc2021.day18 as aoc +import aoc_cas.aoc2021.day18 as aoc data = """ [[[0,[5,8]],[[1,7],[9,6]]],[[4,[1,2]],[[1,4],2]]] diff --git a/tests/2021/test_2021_day2.py b/tests/2021/test_2021_day2.py index 36582a4..7ab8bae 100644 --- a/tests/2021/test_2021_day2.py +++ b/tests/2021/test_2021_day2.py @@ -1,4 +1,4 @@ -import aoc2021.day2 as aoc +import aoc_cas.aoc2021.day2 as aoc testData = """ forward 5 diff --git a/tests/2021/test_2021_day3.py b/tests/2021/test_2021_day3.py index 622452f..48626e1 100644 --- a/tests/2021/test_2021_day3.py +++ b/tests/2021/test_2021_day3.py @@ -1,4 +1,4 @@ -import aoc2021.day3 as aoc +import aoc_cas.aoc2021.day3 as aoc testData = """ 00100 diff --git a/tests/2021/test_2021_day4.py b/tests/2021/test_2021_day4.py index 3049283..38dc796 100644 --- a/tests/2021/test_2021_day4.py +++ b/tests/2021/test_2021_day4.py @@ -1,4 +1,4 @@ -import aoc2021.day4 as aoc +import aoc_cas.aoc2021.day4 as aoc testData = """ 7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1 diff --git a/tests/2021/test_2021_day5.py b/tests/2021/test_2021_day5.py index d8f0ab6..86d0654 100644 --- a/tests/2021/test_2021_day5.py +++ b/tests/2021/test_2021_day5.py @@ -1,4 +1,4 @@ -import aoc2021.day5 as aoc +import aoc_cas.aoc2021.day5 as aoc testData = """ 0,9 -> 5,9 diff --git a/tests/2021/test_2021_day6.py b/tests/2021/test_2021_day6.py index 512643e..6d6d64c 100644 --- a/tests/2021/test_2021_day6.py +++ b/tests/2021/test_2021_day6.py @@ -1,4 +1,4 @@ -import aoc2021.day6 as aoc +import aoc_cas.aoc2021.day6 as aoc testData = """ 3,4,3,1,2 diff --git a/tests/2021/test_2021_day7.py b/tests/2021/test_2021_day7.py index c3f30a1..ec2a766 100644 --- a/tests/2021/test_2021_day7.py +++ b/tests/2021/test_2021_day7.py @@ -1,4 +1,4 @@ -import aoc2021.day7 as aoc +import aoc_cas.aoc2021.day7 as aoc testData = """ 16,1,2,0,4,2,7,1,2,14 diff --git a/tests/2021/test_2021_day8.py b/tests/2021/test_2021_day8.py index 0e7fbaf..f2133bb 100644 --- a/tests/2021/test_2021_day8.py +++ b/tests/2021/test_2021_day8.py @@ -1,4 +1,4 @@ -import aoc2021.day8 as aoc +import aoc_cas.aoc2021.day8 as aoc testData = """ be cfbegad cbdgef fgaecd cgeb fdcge agebfd fecdb fabcd edb | fdgacbe cefdb cefbgd gcbe diff --git a/tests/2021/test_2021_day9.py b/tests/2021/test_2021_day9.py index cf58203..745b9c2 100644 --- a/tests/2021/test_2021_day9.py +++ b/tests/2021/test_2021_day9.py @@ -1,4 +1,4 @@ -import aoc2021.day9 as aoc +import aoc_cas.aoc2021.day9 as aoc testData = """ 2199943210 diff --git a/tests/2022/a.txt b/tests/2022/a.txt deleted file mode 100644 index f3f1349..0000000 --- a/tests/2022/a.txt +++ /dev/null @@ -1,16 +0,0 @@ -1000 -2000 -3000 - -4000 - -5000 -6000 - -7000 -8000 -9000 - -10000 -24000 -45000 diff --git a/tests/2022/test_2022_day10.py b/tests/2022/test_2022_day10.py index 2c7ae9a..4e2cd25 100644 --- a/tests/2022/test_2022_day10.py +++ b/tests/2022/test_2022_day10.py @@ -1,4 +1,4 @@ -import aoc2022.day10 as aoc +import aoc_cas.aoc2022.day10 as aoc testData = """ addx 15 diff --git a/tests/2022/test_2022_day11.py b/tests/2022/test_2022_day11.py index 12e9bbe..c7004e6 100644 --- a/tests/2022/test_2022_day11.py +++ b/tests/2022/test_2022_day11.py @@ -1,4 +1,4 @@ -import aoc2022.day11 as aoc +import aoc_cas.aoc2022.day11 as aoc testData = """ Monkey 0: diff --git a/tests/2022/test_2022_day12.py b/tests/2022/test_2022_day12.py index 4647d0c..bc947fb 100644 --- a/tests/2022/test_2022_day12.py +++ b/tests/2022/test_2022_day12.py @@ -1,4 +1,4 @@ -import aoc2022.day12 as aoc +import aoc_cas.aoc2022.day12 as aoc testData = """ Sabqponm diff --git a/tests/2022/test_2022_day13.py b/tests/2022/test_2022_day13.py index 7f1cf9d..b31965b 100644 --- a/tests/2022/test_2022_day13.py +++ b/tests/2022/test_2022_day13.py @@ -1,4 +1,4 @@ -import aoc2022.day13 as aoc +import aoc_cas.aoc2022.day13 as aoc testData = """ [1,1,3,1,1] diff --git a/tests/2022/test_2022_day14.py b/tests/2022/test_2022_day14.py index 278185b..466a7d8 100644 --- a/tests/2022/test_2022_day14.py +++ b/tests/2022/test_2022_day14.py @@ -1,4 +1,4 @@ -import aoc2022.day14 as aoc +import aoc_cas.aoc2022.day14 as aoc testData = """ 498,4 -> 498,6 -> 496,6 diff --git a/tests/2022/test_2022_day15.py b/tests/2022/test_2022_day15.py index f8b7275..d150f23 100644 --- a/tests/2022/test_2022_day15.py +++ b/tests/2022/test_2022_day15.py @@ -1,4 +1,4 @@ -import aoc2022.day15 as aoc +import aoc_cas.aoc2022.day15 as aoc testData = """ Sensor at x=2, y=18: closest beacon is at x=-2, y=15 diff --git a/tests/2022/test_2022_day16.py b/tests/2022/test_2022_day16.py index a7b2d37..ac0abae 100644 --- a/tests/2022/test_2022_day16.py +++ b/tests/2022/test_2022_day16.py @@ -1,4 +1,4 @@ -import aoc2022.day16 as aoc +import aoc_cas.aoc2022.day16 as aoc testData = """ Valve AA has flow rate=0; tunnels lead to valves DD, II, BB diff --git a/tests/2022/test_2022_day2.py b/tests/2022/test_2022_day2.py index 9cc882c..13de8c3 100644 --- a/tests/2022/test_2022_day2.py +++ b/tests/2022/test_2022_day2.py @@ -1,4 +1,4 @@ -import aoc2022.day2 as aoc +import aoc_cas.aoc2022.day2 as aoc testData = """ A Y diff --git a/tests/2022/test_2022_day3.py b/tests/2022/test_2022_day3.py index a234430..58dbfbd 100644 --- a/tests/2022/test_2022_day3.py +++ b/tests/2022/test_2022_day3.py @@ -1,4 +1,4 @@ -import aoc2022.day3 as aoc +import aoc_cas.aoc2022.day3 as aoc testData = """ vJrwpWtwJgWrhcsFMMfFFhFp diff --git a/tests/2022/test_2022_day4.py b/tests/2022/test_2022_day4.py index cdbbe52..f15e67f 100644 --- a/tests/2022/test_2022_day4.py +++ b/tests/2022/test_2022_day4.py @@ -1,4 +1,4 @@ -import aoc2022.day4 as aoc +import aoc_cas.aoc2022.day4 as aoc testData = """ 2-4,6-8 diff --git a/tests/2022/test_2022_day5.py b/tests/2022/test_2022_day5.py index bb8e13d..7355a16 100644 --- a/tests/2022/test_2022_day5.py +++ b/tests/2022/test_2022_day5.py @@ -1,4 +1,4 @@ -import aoc2022.day5 as aoc +import aoc_cas.aoc2022.day5 as aoc testData = """ [D] [N] [C] diff --git a/tests/2022/test_2022_day6.py b/tests/2022/test_2022_day6.py index cb2564e..f2e8649 100644 --- a/tests/2022/test_2022_day6.py +++ b/tests/2022/test_2022_day6.py @@ -1,4 +1,4 @@ -import aoc2022.day6 as aoc +import aoc_cas.aoc2022.day6 as aoc def testPart1(): diff --git a/tests/2022/test_2022_day7.py b/tests/2022/test_2022_day7.py index 9adba22..689fa4c 100644 --- a/tests/2022/test_2022_day7.py +++ b/tests/2022/test_2022_day7.py @@ -1,4 +1,4 @@ -import aoc2022.day7 as aoc +import aoc_cas.aoc2022.day7 as aoc testData = """ $ cd / diff --git a/tests/2022/test_2022_day8.py b/tests/2022/test_2022_day8.py index 9177025..c0a4098 100644 --- a/tests/2022/test_2022_day8.py +++ b/tests/2022/test_2022_day8.py @@ -1,4 +1,4 @@ -import aoc2022.day8 as aoc +import aoc_cas.aoc2022.day8 as aoc testData = """ 30373 diff --git a/tests/2022/test_2022_day9.py b/tests/2022/test_2022_day9.py index c639bcf..28ea9c6 100644 --- a/tests/2022/test_2022_day9.py +++ b/tests/2022/test_2022_day9.py @@ -1,4 +1,4 @@ -import aoc2022.day9 as aoc +import aoc_cas.aoc2022.day9 as aoc def testPart1(): diff --git a/tests/fixtures/2023/1/b.txt b/tests/fixtures/2023/1.txt similarity index 65% rename from tests/fixtures/2023/1/b.txt rename to tests/fixtures/2023/1.txt index 8208542..d177cf9 100644 --- a/tests/fixtures/2023/1/b.txt +++ b/tests/fixtures/2023/1.txt @@ -1,3 +1,10 @@ +1abc2 +pqr3stu8vwx +a1b2c3d4e5f +treb7uchet +142 +- +=== two1nine eightwothree abcone2threexyz @@ -5,6 +12,5 @@ xtwone3four 4nineeightseven2 zoneight234 7pqrstsixteen - - 281 \ No newline at end of file diff --git a/tests/fixtures/2023/1/a.txt b/tests/fixtures/2023/1/a.txt deleted file mode 100644 index 47d7c23..0000000 --- a/tests/fixtures/2023/1/a.txt +++ /dev/null @@ -1,7 +0,0 @@ -1abc2 -pqr3stu8vwx -a1b2c3d4e5f -treb7uchet - -142 -- \ No newline at end of file diff --git a/tests/test_examples.py b/tests/test_examples.py index 61130f7..9649d33 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -4,13 +4,13 @@ import pytest -here = pathlib.Path(__file__).parent -input_files = sorted(here.glob("fixtures/20*/*/*.txt")) +here = pathlib.Path(__file__).parent.resolve() +input_files = sorted(here.glob("fixtures/20*/*.txt")) def path2id(input_file): - *pre, year, day, fname = input_file.parts - return f"{year} - {day} - {fname}" + *pre, year, fname = input_file.parts + return f"{year} - {fname[:-4]}" def remove_trailing_comments(lines): @@ -23,24 +23,23 @@ def remove_trailing_comments(lines): @pytest.mark.parametrize("input_file", input_files, ids=path2id) -def test_example(input_file, request): - *pre, year, day, fname = input_file.parts +def test_examples(input_file): + *pre, year, fname = input_file.parts year = int(year) - day = int(day) - lines = input_file.read_text(encoding="utf-8").splitlines() - remove_trailing_comments(lines) - if len(lines) < 3: - pytest.fail(f"test data {input_file} is malformed") - *lines, expected_answer_a, expected_answer_b = lines - input_data = "\n".join(lines).rstrip() - module_name = f"aoc_cas.aoc{year}.day{day}" - mod = importlib.import_module(module_name) - if expected_answer_a != "-": - actual_answer_a = str(mod.part1(input_data)) - assert actual_answer_a == expected_answer_a, f"{actual_answer_a=} {expected_answer_a=}" - if expected_answer_b != "-": - actual_answer_b = str(mod.part2(input_data)) - assert actual_answer_b == expected_answer_b, f"{actual_answer_b=} {expected_answer_b=}" - - - + day = int(fname[:-4]) + groups = input_file.read_text(encoding="utf-8").split("\n===\n") + for group in groups: + lines = group.splitlines() + remove_trailing_comments(lines) + if len(lines) < 3: + pytest.fail(f"test data {input_file} is malformed") + *lines, expected_answer_a, expected_answer_b = lines + input_data = "\n".join(lines).rstrip() + module_name = f"aoc_cas.aoc{year}.day{day}" + mod = importlib.import_module(module_name) + if expected_answer_a != "-": + actual_answer_a = str(mod.part1(input_data)) + assert actual_answer_a == expected_answer_a, f"{actual_answer_a=} {expected_answer_a=}" + if expected_answer_b != "-": + actual_answer_b = str(mod.part2(input_data)) + assert actual_answer_b == expected_answer_b, f"{actual_answer_b=} {expected_answer_b=}"