Skip to content

Commit e0a4e23

Browse files
committed
Add test cases for multilink modifying functions.
1 parent 56934b8 commit e0a4e23

File tree

1 file changed

+180
-0
lines changed

1 file changed

+180
-0
lines changed

tests/test_model_sync.py

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3461,6 +3461,15 @@ def test_model_sync_multi_link_04(self):
34613461

34623462
# With linkprops
34633463
self._testcase_update(default.SourceWithProp, [], [], [])
3464+
self._testcase_update(
3465+
default.SourceWithProp,
3466+
[],
3467+
[target_a, target_b],
3468+
[
3469+
default.SourceWithProp.targets.link(target_a),
3470+
default.SourceWithProp.targets.link(target_b),
3471+
],
3472+
)
34643473
self._testcase_update(
34653474
default.SourceWithProp,
34663475
[],
@@ -3498,6 +3507,18 @@ def test_model_sync_multi_link_04(self):
34983507
default.SourceWithProp.targets.link(target_b),
34993508
],
35003509
)
3510+
self._testcase_update(
3511+
default.SourceWithProp,
3512+
[
3513+
default.SourceWithProp.targets.link(target_a),
3514+
default.SourceWithProp.targets.link(target_b),
3515+
],
3516+
[target_a, target_b],
3517+
[
3518+
default.SourceWithProp.targets.link(target_a),
3519+
default.SourceWithProp.targets.link(target_b),
3520+
],
3521+
)
35013522
self._testcase_update(
35023523
default.SourceWithProp,
35033524
[
@@ -3589,6 +3610,20 @@ def test_model_sync_multi_link_04(self):
35893610
],
35903611
)
35913612

3613+
self._testcase_update(
3614+
default.SourceWithProp,
3615+
[
3616+
default.SourceWithProp.targets.link(target_a),
3617+
default.SourceWithProp.targets.link(target_b),
3618+
],
3619+
[target_c, target_d],
3620+
[
3621+
default.SourceWithProp.targets.link(target_a),
3622+
default.SourceWithProp.targets.link(target_b),
3623+
default.SourceWithProp.targets.link(target_c),
3624+
default.SourceWithProp.targets.link(target_d),
3625+
],
3626+
)
35923627
self._testcase_update(
35933628
default.SourceWithProp,
35943629
[
@@ -3836,6 +3871,12 @@ def test_model_sync_multi_link_05(self):
38363871
)
38373872

38383873
# With linkprops
3874+
self._testcase_add(
3875+
default.SourceWithProp,
3876+
[],
3877+
target_a,
3878+
[default.SourceWithProp.targets.link(target_a)],
3879+
)
38393880
self._testcase_add(
38403881
default.SourceWithProp,
38413882
[],
@@ -3849,6 +3890,12 @@ def test_model_sync_multi_link_05(self):
38493890
[default.SourceWithProp.targets.link(target_a, lprop=1)],
38503891
)
38513892

3893+
self._testcase_add(
3894+
default.SourceWithProp,
3895+
[default.SourceWithProp.targets.link(target_a)],
3896+
target_a,
3897+
[default.SourceWithProp.targets.link(target_a)],
3898+
)
38523899
self._testcase_add(
38533900
default.SourceWithProp,
38543901
[default.SourceWithProp.targets.link(target_a)],
@@ -3882,6 +3929,21 @@ def test_model_sync_multi_link_05(self):
38823929
[default.SourceWithProp.targets.link(target_a, lprop=2)],
38833930
)
38843931

3932+
self._testcase_add(
3933+
default.SourceWithProp,
3934+
[
3935+
default.SourceWithProp.targets.link(target_a),
3936+
default.SourceWithProp.targets.link(target_b),
3937+
default.SourceWithProp.targets.link(target_c),
3938+
],
3939+
target_d,
3940+
[
3941+
default.SourceWithProp.targets.link(target_a),
3942+
default.SourceWithProp.targets.link(target_b),
3943+
default.SourceWithProp.targets.link(target_c),
3944+
default.SourceWithProp.targets.link(target_d),
3945+
],
3946+
)
38853947
self._testcase_add(
38863948
default.SourceWithProp,
38873949
[
@@ -3979,6 +4041,12 @@ def _testcase_discard(
39794041
)
39804042

39814043
# With linkprops
4044+
_testcase_discard(
4045+
default.SourceWithProp,
4046+
[default.SourceWithProp.targets.link(target_a)],
4047+
target_a,
4048+
[],
4049+
)
39824050
_testcase_discard(
39834051
default.SourceWithProp,
39844052
[default.SourceWithProp.targets.link(target_a)],
@@ -4011,6 +4079,19 @@ def _testcase_discard(
40114079
[],
40124080
)
40134081

4082+
_testcase_discard(
4083+
default.SourceWithProp,
4084+
[
4085+
default.SourceWithProp.targets.link(target_a),
4086+
default.SourceWithProp.targets.link(target_b),
4087+
default.SourceWithProp.targets.link(target_c),
4088+
],
4089+
target_c,
4090+
[
4091+
default.SourceWithProp.targets.link(target_a),
4092+
default.SourceWithProp.targets.link(target_b),
4093+
],
4094+
)
40144095
_testcase_discard(
40154096
default.SourceWithProp,
40164097
[
@@ -4084,6 +4165,20 @@ def _testcase_discard(
40844165
target_d,
40854166
[target_a, target_b, target_c],
40864167
)
4168+
_testcase_discard(
4169+
default.SourceWithProp,
4170+
[
4171+
default.SourceWithProp.targets.link(target_a),
4172+
default.SourceWithProp.targets.link(target_b),
4173+
default.SourceWithProp.targets.link(target_c),
4174+
],
4175+
target_d,
4176+
[
4177+
default.SourceWithProp.targets.link(target_a),
4178+
default.SourceWithProp.targets.link(target_b),
4179+
default.SourceWithProp.targets.link(target_c),
4180+
],
4181+
)
40874182
_testcase_discard(
40884183
default.SourceWithProp,
40894184
[
@@ -4160,6 +4255,12 @@ def _testcase_remove(
41604255
)
41614256

41624257
# With linkprops
4258+
_testcase_remove(
4259+
default.SourceWithProp,
4260+
[default.SourceWithProp.targets.link(target_a)],
4261+
target_a,
4262+
[],
4263+
)
41634264
_testcase_remove(
41644265
default.SourceWithProp,
41654266
[default.SourceWithProp.targets.link(target_a)],
@@ -4192,6 +4293,19 @@ def _testcase_remove(
41924293
[],
41934294
)
41944295

4296+
_testcase_remove(
4297+
default.SourceWithProp,
4298+
[
4299+
default.SourceWithProp.targets.link(target_a),
4300+
default.SourceWithProp.targets.link(target_b),
4301+
default.SourceWithProp.targets.link(target_c),
4302+
],
4303+
target_c,
4304+
[
4305+
default.SourceWithProp.targets.link(target_a),
4306+
default.SourceWithProp.targets.link(target_b),
4307+
],
4308+
)
41954309
_testcase_remove(
41964310
default.SourceWithProp,
41974311
[
@@ -4343,6 +4457,15 @@ def test_model_sync_multi_link_08(self):
43434457

43444458
# With linkprops
43454459
self._testcase_op_iadd(default.SourceWithProp, [], [], [])
4460+
self._testcase_op_iadd(
4461+
default.SourceWithProp,
4462+
[],
4463+
[target_a, target_b],
4464+
[
4465+
default.SourceWithProp.targets.link(target_a),
4466+
default.SourceWithProp.targets.link(target_b),
4467+
],
4468+
)
43464469
self._testcase_op_iadd(
43474470
default.SourceWithProp,
43484471
[],
@@ -4380,6 +4503,18 @@ def test_model_sync_multi_link_08(self):
43804503
default.SourceWithProp.targets.link(target_b),
43814504
],
43824505
)
4506+
self._testcase_op_iadd(
4507+
default.SourceWithProp,
4508+
[
4509+
default.SourceWithProp.targets.link(target_a),
4510+
default.SourceWithProp.targets.link(target_b),
4511+
],
4512+
[target_a, target_b],
4513+
[
4514+
default.SourceWithProp.targets.link(target_a),
4515+
default.SourceWithProp.targets.link(target_b),
4516+
],
4517+
)
43834518
self._testcase_op_iadd(
43844519
default.SourceWithProp,
43854520
[
@@ -4471,6 +4606,20 @@ def test_model_sync_multi_link_08(self):
44714606
],
44724607
)
44734608

4609+
self._testcase_op_iadd(
4610+
default.SourceWithProp,
4611+
[
4612+
default.SourceWithProp.targets.link(target_a),
4613+
default.SourceWithProp.targets.link(target_b),
4614+
],
4615+
[target_c, target_d],
4616+
[
4617+
default.SourceWithProp.targets.link(target_a),
4618+
default.SourceWithProp.targets.link(target_b),
4619+
default.SourceWithProp.targets.link(target_c),
4620+
default.SourceWithProp.targets.link(target_d),
4621+
],
4622+
)
44744623
self._testcase_op_iadd(
44754624
default.SourceWithProp,
44764625
[
@@ -4732,6 +4881,12 @@ def _testcase_op_isub(
47324881

47334882
# With linkprops
47344883
_testcase_op_isub(default.SourceWithProp, [], [], [])
4884+
_testcase_op_isub(
4885+
default.SourceWithProp,
4886+
[],
4887+
[target_a],
4888+
[],
4889+
)
47354890
_testcase_op_isub(
47364891
default.SourceWithProp,
47374892
[],
@@ -4751,6 +4906,12 @@ def _testcase_op_isub(
47514906
[],
47524907
[default.SourceWithProp.targets.link(target_a)],
47534908
)
4909+
_testcase_op_isub(
4910+
default.SourceWithProp,
4911+
[default.SourceWithProp.targets.link(target_a)],
4912+
[target_a],
4913+
[],
4914+
)
47544915
_testcase_op_isub(
47554916
default.SourceWithProp,
47564917
[default.SourceWithProp.targets.link(target_a)],
@@ -4763,6 +4924,12 @@ def _testcase_op_isub(
47634924
[default.SourceWithProp.targets.link(target_a, lprop=1)],
47644925
[],
47654926
)
4927+
_testcase_op_isub(
4928+
default.SourceWithProp,
4929+
[default.SourceWithProp.targets.link(target_a)],
4930+
[target_b],
4931+
[default.SourceWithProp.targets.link(target_a)],
4932+
)
47664933
_testcase_op_isub(
47674934
default.SourceWithProp,
47684935
[default.SourceWithProp.targets.link(target_a)],
@@ -4801,6 +4968,19 @@ def _testcase_op_isub(
48014968
[default.SourceWithProp.targets.link(target_a, lprop=1)],
48024969
)
48034970

4971+
_testcase_op_isub(
4972+
default.Source,
4973+
[
4974+
default.SourceWithProp.targets.link(target_a),
4975+
default.SourceWithProp.targets.link(target_b),
4976+
default.SourceWithProp.targets.link(target_c),
4977+
],
4978+
[target_c, target_d],
4979+
[
4980+
default.SourceWithProp.targets.link(target_a),
4981+
default.SourceWithProp.targets.link(target_b),
4982+
],
4983+
)
48044984
_testcase_op_isub(
48054985
default.Source,
48064986
[

0 commit comments

Comments
 (0)