From 41ca1f56330a7bc10b4166c2350cdafd64ca8e46 Mon Sep 17 00:00:00 2001 From: Chaeil Yun Date: Thu, 25 Apr 2024 14:32:14 -0400 Subject: [PATCH] local push --- testing/local_testing/add_function.py | 3 +++ testing/local_testing/local_test_0.py | 16 ++++++++++++++++ testing/local_testing/local_test_test.py | 22 ++++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 testing/local_testing/add_function.py create mode 100644 testing/local_testing/local_test_0.py create mode 100644 testing/local_testing/local_test_test.py diff --git a/testing/local_testing/add_function.py b/testing/local_testing/add_function.py new file mode 100644 index 000000000..40bd7ec64 --- /dev/null +++ b/testing/local_testing/add_function.py @@ -0,0 +1,3 @@ +def add(a, b): + return a + b + diff --git a/testing/local_testing/local_test_0.py b/testing/local_testing/local_test_0.py new file mode 100644 index 000000000..95dbd553c --- /dev/null +++ b/testing/local_testing/local_test_0.py @@ -0,0 +1,16 @@ +import pytest + +@pytest.mark.parametrize("arg1, arg2", [(1, 1)]) +def test_parametrization(arg1, arg2): + assert arg1 == arg2 + assert arg1 + 1 == arg2 + 1 + + +# Gets the error: In test_parametrization: indirect fixture '(1, 1)' doesn't exist +# Goal is to change this message into a more beginner friendly message. + +# The error message lives in this path: pytest/src/_pytest/python.py + + + +#("arg1", "arg2"), and "arg1, arg2" works, but cannot put in default parameters as normal function \ No newline at end of file diff --git a/testing/local_testing/local_test_test.py b/testing/local_testing/local_test_test.py new file mode 100644 index 000000000..a677697bf --- /dev/null +++ b/testing/local_testing/local_test_test.py @@ -0,0 +1,22 @@ +# test_math_operations.py + +import pytest +import add_function + + +result_index = [ + (1, 2, 3), + (-1, 1, 0), + (0, 0, 0), + (5, -3, 2), + (1, 1, 2) +] + +@pytest.mark.parametrize("a, b, expected_result", result_index) + + +def test_add(a, b, expected_result): + assert add_function.add(a, b) == expected_result + + +