aboutsummaryrefslogtreecommitdiff
path: root/wqflask/tests/unit/base/test_webqtl_case_data.py
blob: e1555cb427ed8ff7a25b41132e9f9b9ab85e4687 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""Tests for wqflask/base/webqtlCaseData.py"""
import unittest

from wqflask import app  # Required because of utility.tools in webqtlCaseData.py
from base.webqtlCaseData import webqtlCaseData


class TestWebqtlCaseData(unittest.TestCase):
    """Tests for WebqtlCaseData class"""

    def setUp(self):
        self.w = webqtlCaseData(name="Test",
                                value=0,
                                variance=0.0,
                                num_cases=10,
                                name2="Test2")

    def test_webqtl_case_data_repr(self):
        self.assertEqual(
            repr(self.w),
            "<webqtlCaseData> value=0.000 variance=0.000 ndata=10 name=Test name2=Test2"
        )

    def test_class_outlier(self):
        self.assertEqual(self.w.class_outlier, "")

    def test_display_value(self):
        self.assertEqual(self.w.display_value, "0.000")
        self.w.value = None
        self.assertEqual(self.w.display_value, "x")

    def test_display_variance(self):
        self.assertEqual(self.w.display_variance, "0.000")
        self.w.variance = None
        self.assertEqual(self.w.display_variance, "x")

    def test_display_num_cases(self):
        self.assertEqual(self.w.display_num_cases, "10")
        self.w.num_cases = None
        self.assertEqual(self.w.display_num_cases, "x")