mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-11 11:04:10 +02:00
table.m2m(..., m2m_table=x) argument
This commit is contained in:
parent
ba1211d445
commit
b6b92980c0
2 changed files with 13 additions and 7 deletions
|
|
@ -74,9 +74,14 @@ def test_m2m_requires_either_records_or_lookup(fresh_db):
|
|||
people.m2m("tags", {"tag": "hello"}, lookup={"foo": "bar"})
|
||||
|
||||
|
||||
def test_m2m_explicit_argument(fresh_db):
|
||||
# .m2m("humans", ..., m2m_table="relationships")
|
||||
assert False
|
||||
def test_m2m_explicit_table_name_argument(fresh_db):
|
||||
people = fresh_db.table("people", pk="id")
|
||||
people.insert({"name": "Wahyu"}).m2m(
|
||||
"tags", lookup={"tag": "Coworker"}, m2m_table="tagged"
|
||||
)
|
||||
assert fresh_db["tags"].exists
|
||||
assert fresh_db["tagged"].exists
|
||||
assert not fresh_db["people_tags"].exists
|
||||
|
||||
|
||||
def test_uses_existing_m2m_table_if_exists(fresh_db):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue