Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit tests #81

Open
felixbur opened this issue Oct 5, 2023 · 0 comments
Open

Add unit tests #81

felixbur opened this issue Oct 5, 2023 · 0 comments

Comments

@felixbur
Copy link
Owner

felixbur commented Oct 5, 2023

Here is an example

  • Add test parameters
  • Test for expected value
  • Add tests/test_to_db.py:
import numpy as np
import pytest

import spmath


@pytest.mark.parametrize(
    'x, expected_y',
    [
        (2, 6.0206),
        (.5, -6.0206),
        (0, -np.Inf),
        (-1, np.nan),
    ],
)
def test_to_db(x, expected_y):
    y = spmath.to_db(x)
    np.testing.assert_allclose(y, expected_y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant