我在编写测试代码时,遇到以下错误代码。我猜这是元组的值的数据类型。但是我想知道数据类型是否合适,并且可能会导致错误。 有人可以帮助我解决此错误吗?
烧瓶测试代码
@pytest.fixture
def app_token(app):
account_id001 = str(uuid.uuid4())
access_token001 = "act001"
refresh_token001 = "ret001"
expire_time = datetime.datetime.now() + datetime.timedelta(seconds=86400)
client_id001 = "cid001"
external_user_id001 = "uid_001"
with app.app_context():
account_1 = Token(account_id=account_id001, access_token=access_token001,
refresh_token=refresh_token001, expire_time=expire_time)
db.session.add(account_1)
client_1 = ClientMaster(client_id=client_id001, account_id=account_id001,
external_user_id=external_user_id001)
db.session.add(client_1)
db.session.commit()
return app
def test_get_clt_id_by_acc_id(app_token):
client_id = get_clt_id_by_acc_id("dummy")
assert client_id is None
account_id = db.session.query(Token.account_id
).filter(Token.access_token=="act001").first()
client_id = get_client_id_by_account_id('account_id').first()
assert isinstance(client_id, tuple)
错误
self = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x105db1b00>, cursor = <sqlite3.Cursor object at 0x105e26ea0>
statement = 'SELECT client_master.client_id AS client_master_client_id \nFROM client_master \nWHERE client_master.account_id = ?\n LIMIT ? OFFSET ?'
parameters = (('fdasdf4472-1bfe-4bce-0978da-a1dfa5b8',), 1, 0), context = <sqlalchemy.dialects.sqlite.base.SQLiteExecutionContext object at 0x105f1c470>
def do_execute(self, cursor, statement, parameters, context=None):
> cursor.execute(statement, parameters)
E sqlalchemy.exc.InterfaceError: <unprintable InterfaceError object>
../../../.pyenv/versions/3.6.5/lib/python3.6/site-packages/sqlalchemy/engine/default.py:507: InterfaceError