aboutsummaryrefslogtreecommitdiff
path: root/tests/qc/test_cells_average.py
blob: cf23e135eebf2b76156fa73e050f830a418867be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""Test average values."""
from random import randint

import pytest
from hypothesis import given
from hypothesis import strategies as st

from quality_control.average import invalid_value as avg_invalid_value

@pytest.mark.skip(reason=("Checks changed. We now enforce values must have at "
                          "least one decimal place"))
@given(num_str=st.from_regex(r"^[0-9]+$", fullmatch=True))
def test_cell_average_value_pass_if_no_decimal_places(num_str):
    """
    GIVEN: `num_str` is a string representing a number with no decimal places,
      e.g. 2, 39, 8420
    WHEN: `num_str` is provided as an argument to `avg_invalid_value` function,
    THEN: `avg_invalid_value` returns `None`
    """
    line, col = randint(0, 100), randint(0, 20)
    assert avg_invalid_value(line, col, num_str) is None