Python MySQLdb.version_info() Examples

The following are 2 code examples of MySQLdb.version_info(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module MySQLdb , or try the search function .
Example #1
Source File: mysql.py    From gprime with GNU General Public License v2.0 5 votes vote down vote up
def get_summary(cls):
        """
        Return a diction of information about this database
        backend.
        """
        summary = {
            "DB-API version": "2.0",
            "Database SQL type": cls.__name__,
            "Database SQL module": "MySQLdb",
            "Database SQL module version": ".".join([str(v) for v in MySQLdb.version_info]),
            "Database SQL module location": MySQLdb.__file__,
        }
        return summary 
Example #2
Source File: test_schema.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def test_quote_value(self):
        import MySQLdb
        editor = connection.schema_editor()
        tested_values = [
            ('string', "'string'"),
            (42, '42'),
            (1.754, '1.754e0' if MySQLdb.version_info >= (1, 3, 14) else '1.754'),
            (False, b'0' if MySQLdb.version_info >= (1, 4, 0) else '0'),
        ]
        for value, expected in tested_values:
            with self.subTest(value=value):
                self.assertEqual(editor.quote_value(value), expected)