Skip to content

Commit

Permalink
Add failing test for DM-46631.
Browse files Browse the repository at this point in the history
  • Loading branch information
TallJimbo committed Oct 23, 2024
1 parent ddf0c64 commit 2f041c1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions python/lsst/daf/butler/registry/tests/_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,24 @@ def testReplace(self):
[r._asdict() for r in self.query_list(db, tables.a.select())], [row1, row2a, row3]
)

def test_replace_pkey_only(self):
"""Test `Database.replace` on a table that only has primary key"""
spec = ddl.TableSpec(
[
ddl.FieldSpec("a1", dtype=sqlalchemy.BigInteger, primaryKey=True),
ddl.FieldSpec("a2", dtype=sqlalchemy.BigInteger, primaryKey=True),
]
)
db = self.makeEmptyDatabase(origin=1)
with db.declareStaticTables(create=True) as context:
table = context.addTable("a", spec)
row1 = {"a1": 1, "a2": 2}
row2 = {"a1": 1, "a2": 3}
db.replace(table, row1)
db.replace(table, row2)
db.replace(table, row1)
self.assertCountEqual([r._asdict() for r in self.query_list(db, table.select())], [row1, row2])

def testEnsure(self):
"""Tests for `Database.ensure`."""
db = self.makeEmptyDatabase(origin=1)
Expand Down

0 comments on commit 2f041c1

Please sign in to comment.