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 formula 6.5 for NEN-EN 1993-1-1_c2_a1_2016 including init files a… #120

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pytest

from blueprints.codes.eurocode.nen_en_1993_1_1_c2_a1_2016.chapter_6_ultimate_limit_state.formula_6_5 import Form6Dot5UnityCheckTensileStrength
from blueprints.validations import NegativeValueError, LessOrEqualToZeroError

# pylint: disable=arguments-differ

Expand All @@ -22,29 +23,28 @@ def test_evaluation(self) -> None:

assert form == pytest.approx(expected)

def test_raise_error_when_negative_n_ed_is_given(self) -> None:
"""Test a negative value for v_rd_s."""
# Example values
n_ed = -7
n_t_rd = 10

with pytest.raises(ValueError):
Form6Dot5UnityCheckTensileStrength(n_ed=n_ed, n_t_rd=n_t_rd)

def test_raise_error_when_negative_n__t_rd_is_given(self) -> None:
"""Test a negative value for v_ccd."""
# Example values
n_ed = 7
n_t_rd = -10

with pytest.raises(ValueError):
Form6Dot5UnityCheckTensileStrength(n_ed=n_ed, n_t_rd=n_t_rd)

def test_raise_error_when_zero_n_t_rd_is_given(self) -> None:
"""Test a negative value for v_td."""
# Example values
n_ed = 10
n_t_rd = 0

with pytest.raises(ValueError):
@pytest.mark.parametrize(
("n_ed", "n_t_rd"),
[
(-7, 10), # n_ed is negative
(7, -10), # n_t_rd is negative
],
)
def test_raise_error_when_negative_is_given(self, n_ed: float, n_t_rd: float) -> None:
"""Test a negative value for n_ed or n_t_rd."""
with pytest.raises(NegativeValueError):
bro-wi marked this conversation as resolved.
Show resolved Hide resolved
Form6Dot5UnityCheckTensileStrength(
n_ed=n_ed,
n_t_rd=n_t_rd
)

@pytest.mark.parametrize(
("n_ed", "n_t_rd"),
[
(7, 0), # n_ed is negative
],
)
def test_raise_error_when_zero_n_t_rd_is_given(self, n_ed: float, n_t_rd: float) -> None:
"""Test a zero value for n_t_rd."""
with pytest.raises(LessOrEqualToZeroError):
Form6Dot5UnityCheckTensileStrength(n_ed=n_ed, n_t_rd=n_t_rd)
Loading