From bab2305b13e605b3faa3ca6673c0ed5f7429b723 Mon Sep 17 00:00:00 2001 From: Jens Peters Date: Sun, 15 Dec 2024 19:39:39 +0100 Subject: [PATCH] 2015: Use pytest --- .github/workflows/main.yml | 2 +- 2015/README.md | 2 +- 2015/day00.py | 14 -------------- 2015/day01.py | 18 ------------------ 2015/test_day00.py | 7 +++++++ 2015/test_day01.py | 11 +++++++++++ 6 files changed, 20 insertions(+), 34 deletions(-) delete mode 100644 2015/day00.py delete mode 100644 2015/day01.py create mode 100644 2015/test_day00.py create mode 100644 2015/test_day01.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 45c5ef8..e4ecaf9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,7 @@ jobs: - name: Run AoC 2015 run: | cd 2015 - python -m unittest *.py + pytest AoC-2017: runs-on: ubuntu-latest diff --git a/2015/README.md b/2015/README.md index 67d48d7..8e3ecad 100644 --- a/2015/README.md +++ b/2015/README.md @@ -11,5 +11,5 @@ Only Linux has been tested. Other platforms might just work though. ## Compile & run ```bash -python -m unittest *.py +pytest ``` diff --git a/2015/day00.py b/2015/day00.py deleted file mode 100644 index e23c0fd..0000000 --- a/2015/day00.py +++ /dev/null @@ -1,14 +0,0 @@ -import unittest - -from util import read_input - - -class Day01(unittest.TestCase): - - def test_part01(self): - input_data = read_input("day00-input.txt") - - self.assertEqual(input_data, '0') - -if __name__ == '__main__': - unittest.main() diff --git a/2015/day01.py b/2015/day01.py deleted file mode 100644 index aee0e33..0000000 --- a/2015/day01.py +++ /dev/null @@ -1,18 +0,0 @@ -import unittest - -from util import read_input - - -class Day00(unittest.TestCase): - - def test_part01(self): - input_data = read_input("day01-input.txt") - - up = input_data.count(')') - down = input_data.count('(') - floor = abs(up - down) - - self.assertEqual(floor, 138) - -if __name__ == '__main__': - unittest.main() diff --git a/2015/test_day00.py b/2015/test_day00.py new file mode 100644 index 0000000..f3d3319 --- /dev/null +++ b/2015/test_day00.py @@ -0,0 +1,7 @@ +from util import read_input + + +def test_part01(): + input_data = read_input("day00-input.txt") + + assert input_data == '0' diff --git a/2015/test_day01.py b/2015/test_day01.py new file mode 100644 index 0000000..a56a3af --- /dev/null +++ b/2015/test_day01.py @@ -0,0 +1,11 @@ +from util import read_input + + +def test_part01(): + input_data = read_input("day01-input.txt") + + up = input_data.count(')') + down = input_data.count('(') + floor = abs(up - down) + + assert floor == 138