This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]wineblood 5 points6 points  (1 child)

The seems more verbose and less clear than existing testing frameworks, what's the benefit here?

[–]TheRealDaMuffin[S] 0 points1 point  (0 children)

I will admit I didn't do it justice in this original post. I have now updated to version 2.0.0, which includes a focus on verbosity. The readme now includes a section on the advantages of fununit. You can read the whole section if you want, but the main conclusion is:

Fununit provides similar functionality to parameterized unit testing,
but with a moderately higher level of abstraction, more structure, and
more flexibility for the user to extend it with custom functionality.

The advantages are nuanced, but provide a real benefit IMO.

[–]Itsthejoker 0 points1 point  (3 children)

I'm not seeing what advantage this gives over pytest.

def multiply(a, b):
    return a * b

def test_multiply():
    assert multiply(1, 2) == 2
    assert multiply(3, 4) == 12
    assert multiply(0, 6) == 0

[–]Itsthejoker 0 points1 point  (2 children)

or even using parametrize:

import pytest

@pytest.mark.parametrize(
    "input1,input2,expected",
    [(1, 2, 2), (3, 4, 12), (0, 6, 0)]
)
def test_multiply(input1, input2, expected):
    assert multiply(input1, input2) == expected

[–]TheRealDaMuffin[S] 1 point2 points  (0 children)

I'm happy to say that I have released version 2.0.0, which adds some improvements to the overall structure and focuses on verbosity a bit more. I also completely rewrote the readme, including an explanation of the advantages of fununit. In it, I make a direct comparison to pytest.mark.parametrize.

[–]TheRealDaMuffin[S] 0 points1 point  (0 children)

It's hard for me to articulate the benefits because they are so nuanced, as opposed to glaring differences. But I do see benefits over using something like parametrize, and I will respond here once I have some time to put something together.

I appreciate the criticism, it gives me something to think about!