コード例 #1
0
    def test_index_reference(self, data, row_num, col_num, expected):
        if not isinstance(data, np.ndarray):
            def lookup_test_data(address):
                address = AddressCell(address)
                return data[address.row - 1][address.col_idx - 1]

            from unittest import mock
            with mock.patch.dict(index.excel_func_meta['name_space'],
                                 {'_C_': lookup_test_data}):
                result = index(self.test_data_ref[data], row_num, col_num)
            if row_num or col_num:
                assert result == expected
            else:
                assert result == self.test_data_ref[data]
コード例 #2
0
 def test_index(data, row_num, col_num, expected):
     result = index(data, row_num, col_num)
     if isinstance(expected, np.ndarray):
         assert (result == expected).all()
     else:
         assert result == expected