Source code for sqlobject.tests.test_mysql
import pytest
from sqlobject import SQLObject, IntCol
from sqlobject.sqlbuilder import Select, ANY
from sqlobject.tests.dbtest import getConnection, setupClass
try:
    connection = getConnection()
except (AttributeError, NameError):
    # The module was imported during documentation building
    pass
else:
    if connection.dbName != "mysql":
        pytestmark = pytest.mark.skip("These tests require MySQL")
[docs]class SOTestSOListMySQL(SQLObject):
    pass 
[docs]def test_list_databases():
    assert connection.db in connection.listDatabases() 
[docs]def test_list_tables():
    setupClass(SOTestSOListMySQL)
    assert SOTestSOListMySQL.sqlmeta.table in connection.listTables() 
[docs]class SOTestANY(SQLObject):
    value = IntCol() 
[docs]def test_ANY():
    setupClass(SOTestANY)
    SOTestANY(value=10)
    SOTestANY(value=20)
    SOTestANY(value=30)
    assert len(list(SOTestANY.select(
        SOTestANY.q.value > ANY(Select([SOTestANY.q.value]))))) == 2