def test_convert_type(self, field_type, value, expected): with patch('bqlib.is_str_or_unicode', return_value=True): if isclass(expected) and issubclass(expected, Exception): with pytest.raises(expected): BQHelper.convert_type(field_type, value) else: assert BQHelper.convert_type(field_type, value) == expected