sqlalchemy_utils.get_bind

Here are the examples of the python api sqlalchemy_utils.get_bind taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

Example 1

Project: sqlalchemy-utils Source File: test_get_bind.py
Function: test_with_session
    def test_with_session(self, session, connection):
        assert get_bind(session) == connection

Example 2

Project: sqlalchemy-utils Source File: test_get_bind.py
Function: test_with_connection
    def test_with_connection(self, session, connection):
        assert get_bind(connection) == connection

Example 3

Project: sqlalchemy-utils Source File: test_get_bind.py
    def test_with_model_object(self, session, connection, Article):
        article = Article()
        session.add(article)
        assert get_bind(article) == connection

Example 4

Project: sqlalchemy-utils Source File: test_get_bind.py
Function: test_with_unknown_type
    def test_with_unknown_type(self):
        with pytest.raises(TypeError):
            get_bind(None)