about summary refs log tree commit diff
path: root/tests/r_qtl/test_utils.py
blob: 7736b70817de46764e08dbdf51e222c14586f5f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Tests for the genotype views helpers."""
import pytest

from r_qtl.utils import parse_missing_values_symbols


@pytest.mark.unit_test
@pytest.mark.parametrize(
    "value,expected",
    (("N", ["N"]),
     ("N ?", ["N", "?"]),
     ("N, ?", ["N", "?"]),
     ("  N,,?  ", ["N", "?"]),
     ("N N", ["N"]),
     ("", []),
     ("   ", [])))
def test_parse_missing_values_symbols(value, expected):
    """
    GIVEN: a whitespace- and/or comma-separated list of symbols
    WHEN: the missing-value symbols are parsed
    THEN: the unique, non-empty symbols are returned in order
    """
    assert parse_missing_values_symbols(value) == expected