|
@@ 64-72 (lines=9) @@
|
| 61 |
|
|
| 62 |
|
cls = TT.UpdateWoReplaceDict |
| 63 |
|
|
| 64 |
|
def check_updated(self, *others, **another): |
| 65 |
|
upd = self.up0 |
| 66 |
|
ref = self.mds[0].copy() |
| 67 |
|
|
| 68 |
|
for md in self.mds: |
| 69 |
|
md.update(*others, **another) |
| 70 |
|
self.assertTrue(all(md[k] == upd[k] for k in upd.keys() |
| 71 |
|
if k not in ref)) |
| 72 |
|
self.assertTrue(all(md[k] == ref[k] for k in ref.keys())) |
| 73 |
|
|
| 74 |
|
|
| 75 |
|
class Test_30_UpdateWithMergeDict(Test_10_UpdateWithReplaceDict): |
|
@@ 22-30 (lines=9) @@
|
| 19 |
|
self.mds = (self.cls(self.od0), self.cls(self.od0.items()), |
| 20 |
|
self.cls(**self.od0)) |
| 21 |
|
|
| 22 |
|
def check_updated(self, *others, **another): |
| 23 |
|
upd = self.up0 |
| 24 |
|
ref = self.mds[0].copy() |
| 25 |
|
|
| 26 |
|
for md in self.mds: |
| 27 |
|
md.update(*others, **another) |
| 28 |
|
self.assertTrue(all(md[k] == upd[k] for k in upd.keys())) |
| 29 |
|
self.assertTrue(all(md[k] == ref[k] for k in ref.keys() |
| 30 |
|
if k not in upd)) |
| 31 |
|
|
| 32 |
|
def test_10_update_with_a_mdict(self): |
| 33 |
|
self.check_updated(self.cls(self.up0)) |