示例#1
0
文件: test_data.py 项目: codechenx/bv
    def test_type(self):
        new_data = Data()
        new_data.type = "vcf"
        assert new_data.type == "vcf"

        with pytest.raises(AssertionError):
            new_data.type = 0
示例#2
0
文件: test_data.py 项目: codechenx/bv
    def test_body(self):
        new_data = Data()
        new_data.body = [['1', '2', '3'], ['4', '5', '6']]
        assert [['1', '2', '3'], ['4', '5', '6']] == new_data.body

        with pytest.raises(AssertionError):
            new_data.body = "something"
示例#3
0
文件: test_data.py 项目: codechenx/bv
 def test_empty(self):
     new_data = Data()
     new_data.type = "vcf"
     new_data.metadata = [['1', '2', '3'], ['4', '5', '6']]
     new_data.body = [['1', '2', '3'], ['4', '5', '6']]
     new_data.header = [['1', '2', '3'], ['4', '5', '6']]
     new_data.empty()
     assert new_data.type == ""
     assert new_data.metadata == []
     assert new_data.body == []
     assert  new_data.header == []
示例#4
0
文件: test_data.py 项目: codechenx/bv
 def test_rm_col(self):
     new_data = Data()
     new_data.header = ['col1', 'col2', 'col3']
     new_data.body = [['1', '2', '3'], ['7', '6', '5'], ['3', '2', '1']]
     new_data.rm_col([1, 2])
     new_data_body = new_data.body
     assert [['1'], ['7'], ['3']] == new_data_body
     assert ['col1'] == new_data.header
示例#5
0
文件: test_data.py 项目: codechenx/bv
 def test_get_col(self):
     new_data = Data()
     new_data.body = [['1', '2', '3'], ['7', '6', '5'], ['3', '2', '1']]
     assert ['2', '6', '2'] == new_data.get_col(1)
     with pytest.raises(AssertionError):
         new_data.get_col(3)
示例#6
0
文件: test_data.py 项目: codechenx/bv
 def test_sorted_by_col(self):
     new_data = Data()
     new_data.body = [['1', '7', '3'], ['2', '5', '2'], ['3', '6', '1']]
     new_data.sorted_by_col(0)
     assert [['1', '7', '3'], ['2', '5', '2'], ['3', '6', '1']] == new_data.body
     new_data.sorted_by_col(1)
     assert [['2', '5', '2'], ['3', '6', '1'], ['1', '7', '3']] == new_data.body
     new_data.sorted_by_col(2)
     assert [['3', '6', '1'], ['2', '5', '2'], ['1', '7', '3']] == new_data.body
     with pytest.raises(AssertionError):
         new_data.sorted_by_col(3)
示例#7
0
文件: test_data.py 项目: codechenx/bv
 def test_sorted_by_row(self):
     new_data = Data()
     new_data.header = ['col1', 'col2', 'col3']
     new_data.body = [['1', '2', '3'], ['6', '5', '7'], ['3', '2', '1']]
     new_data.sorted_by_row(0)
     assert [['1', '2', '3'], ['6', '5', '7'], ['3', '2', '1']] == new_data.body
     assert ['col1', 'col2', 'col3'] == new_data.header
     new_data.sorted_by_row(1)
     assert [['2', '1', '3'], ['5', '6', '7'], ['2', '3', '1']] == new_data.body
     assert ['col2', 'col1', 'col3'] == new_data.header
     new_data.sorted_by_row(2)
     assert [['3', '2', '1'], ['7', '5', '6'], ['1', '2', '3']] == new_data.body
     assert ['col3', 'col2', 'col1'] == new_data.header
     with pytest.raises(AssertionError):
         new_data.sorted_by_row(3)
示例#8
0
文件: test_data.py 项目: codechenx/bv
 def test_size(self):
     new_data = Data()
     new_data.body = [['1', '2', '3'], ['4', '5', '6']]
     assert (2, 3) == new_data.size
示例#9
0
文件: test_data.py 项目: codechenx/bv
 def test_header(self):
     new_data = Data()
     new_data.header = ['1', '2', '3']
     assert ['1', '2', '3'] == new_data.header
     with pytest.raises(AssertionError):
         new_data.header = "something"
示例#10
0
文件: test_data.py 项目: codechenx/bv
 def test_covert_possible_col_numberic(self):
     new_data = Data()
     new_data.body = [['1', '2', '3'], ['7', '6', '5'], ['3', 'a', '1']]
     new_data.covert_possible_col_numberic()
     assert [[1, '2', 3], [7, '6', 5], [3, 'a', 1]] == new_data.body
示例#11
0
文件: test_data.py 项目: codechenx/bv
 def test_rm_row(self):
     new_data = Data()
     new_data.body = [['1', '2', '3'], ['7', '6', '5'], ['3', '2', '1']]
     new_data.rm_row([1, 2])
     new_data_body = new_data.body
     assert [['1', '2', '3']] == new_data_body