$58 GRAYBYTE WORDPRESS FILE MANAGER $67

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

/lib64/python2.7/site-packages/sqlalchemy/testing/suite/

HOME
Current File : /lib64/python2.7/site-packages/sqlalchemy/testing/suite//test_update_delete.py
# testing/suite/test_update_delete.py
# Copyright (C) 2005-2024 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
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"
    __requires__ = ("sane_rowcount",)
    __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, connection):
        connection.execute(
            cls.tables.plain_pk.insert(),
            [
                {"id": 1, "data": "d1"},
                {"id": 2, "data": "d2"},
                {"id": 3, "data": "d3"},
            ],
        )

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

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

    def test_delete(self, connection):
        t = self.tables.plain_pk
        r = connection.execute(t.delete().where(t.c.id == 2))
        assert not r.is_insert
        assert not r.returns_rows
        assert r.rowcount == 1
        eq_(
            connection.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
..
--
23 Sep 2024 10.41 AM
root / root
0755
__init__.py
0.705 KB
5 Sep 2024 10.50 PM
root / root
0644
__init__.pyc
0.544 KB
23 Sep 2024 10.41 AM
root / root
0644
test_cte.py
6.278 KB
5 Sep 2024 10.50 PM
root / root
0644
test_cte.pyc
5.922 KB
23 Sep 2024 10.41 AM
root / root
0644
test_ddl.py
11.727 KB
5 Sep 2024 10.50 PM
root / root
0644
test_ddl.pyc
13.649 KB
23 Sep 2024 10.41 AM
root / root
0644
test_deprecations.py
5.189 KB
5 Sep 2024 10.50 PM
root / root
0644
test_deprecations.pyc
5.749 KB
23 Sep 2024 10.41 AM
root / root
0644
test_dialect.py
12.845 KB
5 Sep 2024 10.50 PM
root / root
0644
test_dialect.pyc
14.484 KB
23 Sep 2024 10.41 AM
root / root
0644
test_insert.py
11.116 KB
5 Sep 2024 10.50 PM
root / root
0644
test_insert.pyc
11.29 KB
23 Sep 2024 10.41 AM
root / root
0644
test_reflection.py
60.271 KB
5 Sep 2024 10.50 PM
root / root
0644
test_reflection.pyc
53.012 KB
23 Sep 2024 10.41 AM
root / root
0644
test_results.py
13.899 KB
5 Sep 2024 10.50 PM
root / root
0644
test_results.pyc
13.577 KB
23 Sep 2024 10.41 AM
root / root
0644
test_rowcount.py
5.008 KB
5 Sep 2024 10.50 PM
root / root
0644
test_rowcount.pyc
5.65 KB
23 Sep 2024 10.41 AM
root / root
0644
test_select.py
55.827 KB
5 Sep 2024 10.50 PM
root / root
0644
test_select.pyc
73.698 KB
23 Sep 2024 10.41 AM
root / root
0644
test_sequence.py
8.479 KB
5 Sep 2024 10.50 PM
root / root
0644
test_sequence.pyc
10.213 KB
23 Sep 2024 10.41 AM
root / root
0644
test_types.py
47.198 KB
5 Sep 2024 10.50 PM
root / root
0644
test_types.pyc
53.136 KB
23 Sep 2024 10.41 AM
root / root
0644
test_unicode_ddl.py
6.827 KB
5 Sep 2024 10.50 PM
root / root
0644
test_unicode_ddl.pyc
5.743 KB
23 Sep 2024 10.41 AM
root / root
0644
test_update_delete.py
1.837 KB
5 Sep 2024 10.50 PM
root / root
0644
test_update_delete.pyc
2.679 KB
23 Sep 2024 10.41 AM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF