Ejemplo n.º 1
0
def test_name_string():
        '''
        assert true when the input is a string > len 0
        '''
        with patch.object(RunSnpDetection, "__init__", lambda x: None):
                detect_obj = RunSnpDetection()
                detect_obj.logger = logging.getLogger(__name__)
                assert detect_obj._name_exists('somestring')
Ejemplo n.º 2
0
def test_with_missing():
        '''
        return False if missing data present
        '''
        with patch.object(RunSnpDetection, "__init__", lambda x: None):
                detect_obj = RunSnpDetection()
                detect_obj.logger = logging.getLogger(__name__)
                tab = pandas.DataFrame({'A':[1,2,4, numpy.nan], 'B':[5,6,7,8], 'C':[9,10,11,12]})
                assert detect_obj.all_data_filled(tab) == False
Ejemplo n.º 3
0
def test_missing():
        '''
        a full dataframe returns true
        '''
        with patch.object(RunSnpDetection, "__init__", lambda x: None):
                detect_obj = RunSnpDetection()
                detect_obj.logger = logging.getLogger(__name__)
                tab = pandas.DataFrame({'A':[1,2,3,4], 'B':[5,6,7,8], 'C':[9,10,11,12]})
                assert detect_obj.all_data_filled(tab)
Ejemplo n.º 4
0
def test_notfour_isolates():
        '''
        return false when less than 4 rows are present
        '''
        with patch.object(RunSnpDetection, "__init__", lambda x: None):
                detect_obj = RunSnpDetection()
                detect_obj.logger = logging.getLogger(__name__)
                tab = pandas.DataFrame({'A':[1,2,3]})
                assert detect_obj.min_four_samples(tab)
Ejemplo n.º 5
0
def test_four_isolates():
        '''
        confirm that min of 4 rows are present
        '''
        with patch.object(RunSnpDetection, "__init__", lambda x: None):
                detect_obj = RunSnpDetection()
                detect_obj.logger = logging.getLogger(__name__)
                tab = pandas.DataFrame({'A':[1,2,3,4]})
                assert detect_obj.min_four_samples(tab) == False
Ejemplo n.º 6
0
def test_2col_dimensions():
        '''
        return False when wrong number of columns present
        '''
        with patch.object(RunSnpDetection, "__init__", lambda x: None):
                detect_obj = RunSnpDetection()
                detect_obj.logger = logging.getLogger(__name__)
                tab = pandas.DataFrame({'A':[1], 'B':[2]})
                assert detect_obj.three_cols(tab) == False
Ejemplo n.º 7
0
def test_3col_dimensions():
        '''
        return True when correct number of columns
        '''
        with patch.object(RunSnpDetection, "__init__", lambda x: None):
                detect_obj = RunSnpDetection()
                detect_obj.logger = logging.getLogger(__name__)
                tab = pandas.DataFrame({'A':[1], 'B':[2], 'C':[3]})
                assert detect_obj.three_cols(tab)
Ejemplo n.º 8
0
def test_name_empty_string():
        '''
        confirm that False is returned if a 0 length strin is input
        '''
        with patch.object(RunSnpDetection, "__init__", lambda x: None):
                detect_obj = RunSnpDetection()
                detect_obj.logger = logging.getLogger(__name__)
                with pytest.raises(SystemExit):
                        detect_obj._name_exists('')
Ejemplo n.º 9
0
def test_name_non_string():
        '''
        if a non string input is used return false
        '''
        with patch.object(RunSnpDetection, "__init__", lambda x: None):
                detect_obj = RunSnpDetection()
                detect_obj.logger = logging.getLogger(__name__)
                with pytest.raises(SystemExit):
                        detect_obj._name_exists(9)
Ejemplo n.º 10
0
def test_path_exists():
        '''
        test that path_exists returns True
        '''
        with patch.object(RunSnpDetection, "__init__", lambda x: None):
                p = pathlib.Path('bohra','tests', 'test_file.txt')
                detect_obj = RunSnpDetection()
                detect_obj.logger = logging.getLogger(__name__)
                assert detect_obj.path_exists(p)
Ejemplo n.º 11
0
def test_structure():
    with patch.object(RunSnpDetection, "__init__", lambda x: None):
        detect_obj = RunSnpDetection()
        detect_obj.logger = logging.getLogger(__name__)
        tab = pandas.DataFrame({
            'A': [1, 2, 3, 4],
            'B': [5, 6, 7, 8],
            'C': [9, 10, 11, 12]
        })
        assert detect_obj.check_input_structure(tab) == True