aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/computations/test_diff.py
blob: 128fb60c0cf5b716a6c2949aadcafacdd67b7a3b (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
"""This contains unit-tests for gn3.computations.diff"""
import unittest
import os

import pytest

from gn3.computations.diff import generate_diff

TESTDIFF = """3,4c3,4
< C57BL/6J,x,x,x
< BXD1,18.700,x,x
---
> C57BL/6J,19.000,x,x
> BXD1,15.700,x,x
6c6
< BXD11,18.900,x,x
---
> BXD11,x,x,x
"""


class TestDiff(unittest.TestCase):
    """Test cases for computations.diff"""
    @pytest.mark.unit_test
    def test_generate_diff(self):
        """Test that the correct diff is generated"""
        data = os.path.join(os.path.dirname(__file__).split("unit")[0],
                            "test_data/trait_data_10007.csv")
        edited_data = os.path.join(os.path.dirname(__file__).split("unit")[0],
                                   "test_data/edited_trait_data_10007.csv")
        self.assertEqual(generate_diff(data, edited_data), TESTDIFF)