sqlalchemy.Boolean.literal_processor

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

11 Examples 7

3 Source : test_types.py
with Apache License 2.0
from gethue

    def test_literal_processor_coercion_native_true(self):
        proc = Boolean().literal_processor(
            default.DefaultDialect(supports_native_boolean=True)
        )
        eq_(proc(True), "true")

    def test_literal_processor_coercion_native_false(self):

3 Source : test_types.py
with Apache License 2.0
from gethue

    def test_literal_processor_coercion_native_false(self):
        proc = Boolean().literal_processor(
            default.DefaultDialect(supports_native_boolean=True)
        )
        eq_(proc(False), "false")

    def test_literal_processor_coercion_native_1(self):

3 Source : test_types.py
with Apache License 2.0
from gethue

    def test_literal_processor_coercion_native_1(self):
        proc = Boolean().literal_processor(
            default.DefaultDialect(supports_native_boolean=True)
        )
        eq_(proc(1), "true")

    def test_literal_processor_coercion_native_0(self):

3 Source : test_types.py
with Apache License 2.0
from gethue

    def test_literal_processor_coercion_native_0(self):
        proc = Boolean().literal_processor(
            default.DefaultDialect(supports_native_boolean=True)
        )
        eq_(proc(0), "false")

    def test_literal_processor_coercion_native_str(self):

3 Source : test_types.py
with Apache License 2.0
from gethue

    def test_literal_processor_coercion_native_str(self):
        proc = Boolean().literal_processor(
            default.DefaultDialect(supports_native_boolean=True)
        )
        assert_raises_message(
            TypeError, "Not a boolean value: 'foo'", proc, "foo"
        )

    def test_literal_processor_coercion_native_int_out_of_range(self):

3 Source : test_types.py
with Apache License 2.0
from gethue

    def test_literal_processor_coercion_native_int_out_of_range(self):
        proc = Boolean().literal_processor(
            default.DefaultDialect(supports_native_boolean=True)
        )
        assert_raises_message(
            ValueError, "Value 15 is not None, True, or False", proc, 15
        )

    def test_literal_processor_coercion_nonnative_true(self):

3 Source : test_types.py
with Apache License 2.0
from gethue

    def test_literal_processor_coercion_nonnative_true(self):
        proc = Boolean().literal_processor(
            default.DefaultDialect(supports_native_boolean=False)
        )
        eq_(proc(True), "1")

    def test_literal_processor_coercion_nonnative_false(self):

3 Source : test_types.py
with Apache License 2.0
from gethue

    def test_literal_processor_coercion_nonnative_false(self):
        proc = Boolean().literal_processor(
            default.DefaultDialect(supports_native_boolean=False)
        )
        eq_(proc(False), "0")

    def test_literal_processor_coercion_nonnative_1(self):

3 Source : test_types.py
with Apache License 2.0
from gethue

    def test_literal_processor_coercion_nonnative_1(self):
        proc = Boolean().literal_processor(
            default.DefaultDialect(supports_native_boolean=False)
        )
        eq_(proc(1), "1")

    def test_literal_processor_coercion_nonnative_0(self):

3 Source : test_types.py
with Apache License 2.0
from gethue

    def test_literal_processor_coercion_nonnative_0(self):
        proc = Boolean().literal_processor(
            default.DefaultDialect(supports_native_boolean=False)
        )
        eq_(proc(0), "0")

    def test_literal_processor_coercion_nonnative_str(self):

3 Source : test_types.py
with Apache License 2.0
from gethue

    def test_literal_processor_coercion_nonnative_str(self):
        proc = Boolean().literal_processor(
            default.DefaultDialect(supports_native_boolean=False)
        )
        assert_raises_message(
            TypeError, "Not a boolean value: 'foo'", proc, "foo"
        )


class PickleTest(fixtures.TestBase):