$83 GRAYBYTE WORDPRESS FILE MANAGER $11

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/testing/suite/

HOME
Current File : /opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/testing/suite//test_update_delete.py
from .. import config
from .. import fixtures
from ..assertions import eq_
from ..schema import Column
from ..schema import Table
from ... import Integer
from ... import String


class SimpleUpdateDeleteTest(fixtures.TablesTest):
    run_deletes = "each"
    __backend__ = True

    @classmethod
    def define_tables(cls, metadata):
        Table(
            "plain_pk",
            metadata,
            Column("id", Integer, primary_key=True),
            Column("data", String(50)),
        )

    @classmethod
    def insert_data(cls):
        config.db.execute(
            cls.tables.plain_pk.insert(),
            [
                {"id": 1, "data": "d1"},
                {"id": 2, "data": "d2"},
                {"id": 3, "data": "d3"},
            ],
        )

    def test_update(self):
        t = self.tables.plain_pk
        r = config.db.execute(t.update().where(t.c.id == 2), data="d2_new")
        assert not r.is_insert
        assert not r.returns_rows

        eq_(
            config.db.execute(t.select().order_by(t.c.id)).fetchall(),
            [(1, "d1"), (2, "d2_new"), (3, "d3")],
        )

    def test_delete(self):
        t = self.tables.plain_pk
        r = config.db.execute(t.delete().where(t.c.id == 2))
        assert not r.is_insert
        assert not r.returns_rows
        eq_(
            config.db.execute(t.select().order_by(t.c.id)).fetchall(),
            [(1, "d1"), (3, "d3")],
        )


__all__ = ("SimpleUpdateDeleteTest",)

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
31 Aug 2024 6.48 AM
root / 996
0755
__pycache__
--
31 Aug 2024 6.48 AM
root / 996
0755
__init__.py
0.35 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_cte.py
6.629 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_ddl.py
2.803 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_dialect.py
4.465 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_insert.py
9.361 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_reflection.py
36.59 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_results.py
11.234 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_select.py
19.516 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_sequence.py
4.552 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_types.py
28.938 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_update_delete.py
1.443 KB
22 Jul 2019 3.36 AM
root / 996
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF