Ticket #77 (closed enhancement: invalid)

Opened 4 years ago

Last modified 4 years ago

a test for unique=True and duplicated entries

Reported by: guest Owned by:
Priority: blocker Milestone:
Component: core Version:
Keywords: unique, integrity, test Cc:

Description

This is a test for the unique=True attribute and for the insertion of duplicated entries.

It creates a table called Individual with the name attribute, which should be unique. Then it tries to insert two records with the same .name attribute and checks whether an IntegrityError is returned.

I couldn't find many examples on unique fields in the docs, so I thought to send you this one.

Attachments

test_DuplicatedEntriesElixir.py (1.0 kB) - added by guest 4 years ago.
test insert of duplicated entries (fixed a type in the previous version)

Change History

Changed 4 years ago by guest

test insert of duplicated entries (fixed a type in the previous version)

Changed 4 years ago by ged

  • status changed from new to closed
  • resolution set to invalid

Thanks a lot for taking the trouble to submit a patch. It's really appreciated. Unfortunately, I won't include it as this argument/feature is forwarded directly to SQLAlchemy without any modification by Elixir, so I don't intend to add a test for it in the Elixir test suite.

Additionally, there is already a FAQ about it (http://elixir.ematia.de/trac/wiki/FAQ#HowdoIdeclareuniquenessconstraints). To make it more obvious, I just commited a small change (r429) to add a column with a unique=True argument in the fields example.

I hope it will be enough. If you still think there should be more coverage, please say so and tell me how you think I could make things clearer without duplicating the whole SQLAlchemy documentation.

Note: See TracTickets for help on using tickets.