Skip to content

Instantly share code, notes, and snippets.

@tomdewildt
Created January 9, 2023 15:09
Show Gist options
  • Save tomdewildt/95b2edf8928d6d048cdfe32e9535bffc to your computer and use it in GitHub Desktop.
Save tomdewildt/95b2edf8928d6d048cdfe32e9535bffc to your computer and use it in GitHub Desktop.
Pytest syntax for the python programming language
# Test case
class TestExample:
def test_example_single(self):
value = function_to_test("value")
assert value == "test"
@pytest.mark.parametrize(
"function_input,function_output",
[
("", None),
("value", "test"),
],
)
def test_example_multiple(self, function_input, function_output):
value = function_to_test(function_input)
assert value == function_output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment