Skip to content

Commit a6d9d96

Browse files
committed
Update tests.
1 parent 59b21cc commit a6d9d96

File tree

2 files changed

+94
-262
lines changed

2 files changed

+94
-262
lines changed

tests/test_model_generator.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3491,12 +3491,10 @@ def test_modelgen_save_44(self):
34913491
# Test link props on multi links -- specifically that we support:
34923492
#
34933493
# - setting some of the props
3494+
# - updating one prop to a new value,
3495+
# - resetting one prop to None
34943496
#
3495-
# - updating one prop with one value,
3496-
# but the other props in the db must survive
3497-
#
3498-
# - resetting one prop to None - with it actually resetting to
3499-
# an empty set in the DB and other props surviving
3497+
# Unspecified props are reset to None. This imitates python semantics.
35003498

35013499
import json
35023500
from typing import Any
@@ -3559,7 +3557,7 @@ def check(expected: Any) -> None:
35593557
check(
35603558
{
35613559
"members": [
3562-
{"name": "Alice", "@rank": 1000, "@role": "lead"},
3560+
{"name": "Alice", "@rank": 1000, "@role": None},
35633561
{"name": "Billie", "@rank": 2, "@role": None},
35643562
]
35653563
}
@@ -3578,7 +3576,7 @@ def check(expected: Any) -> None:
35783576
check(
35793577
{
35803578
"members": [
3581-
{"name": "Alice", "@rank": None, "@role": "lead"},
3579+
{"name": "Alice", "@rank": None, "@role": None},
35823580
{"name": "Billie", "@rank": 2, "@role": None},
35833581
]
35843582
}
@@ -5065,8 +5063,7 @@ def test_modelgen_linkprops_07(self):
50655063

50665064
# Fetch the team
50675065
team1 = self.client.get(default.Team.filter(name="Taco Wizards"))
5068-
# Merge this new link (rank is "unset", so we don't expect it to
5069-
# change)
5066+
# Merge this new link (rank is "unset", so we expect it to reset)
50705067
team1.members.add(default.Team.members.link(u, role="sorceress"))
50715068
self.client.save(team1)
50725069

@@ -5077,7 +5074,7 @@ def test_modelgen_linkprops_07(self):
50775074

50785075
member = list(team2.members)[0]
50795076
self.assertEqual(member.name, "Zoe")
5080-
self.assertEqual(member.__linkprops__.rank, 1)
5077+
self.assertEqual(member.__linkprops__.rank, None)
50815078
self.assertEqual(member.__linkprops__.role, "sorceress")
50825079

50835080
@tb.xfail

0 commit comments

Comments
 (0)