Code Duplication    Length = 16-17 lines in 2 locations

m9dicts/tests/dicts.py 2 locations

@@ 93-109 (lines=17) @@
90
                                if k not in upd))
91
92
93
class Test_32_UpdateWithMergeDict_kept(Test_10_UpdateWithReplaceDict):
94
95
    class UWMDK(TT.UpdateWithMergeDict):
96
        keep = True
97
98
    cls = UWMDK
99
100
    def check_updated(self, *others, **another):
101
        upd = self.up0
102
        ref = self.mds[0].copy()
103
104
        for md in self.mds:
105
            md.update(*others, **another)
106
            self.assertTrue(all(md[k] == upd[k] for k in ["d"]))
107
            self.assertEqual(md["c"], ref["c"])
108
            self.assertTrue(all(md[k] == ref[k] for k in ref.keys()
109
                                if k not in upd))
110
111
112
class Test_34_UpdateWithMergeListsDict(Test_30_UpdateWithMergeDict):
@@ 75-90 (lines=16) @@
72
            self.assertTrue(all(md[k] == ref[k] for k in ref.keys()))
73
74
75
class Test_30_UpdateWithMergeDict(Test_10_UpdateWithReplaceDict):
76
77
    cls = TT.UpdateWithMergeDict
78
    replaced_keys = "a b d".split()
79
80
    def check_updated(self, *others, **another):
81
        upd = self.up0
82
        ref = self.mds[0].copy()
83
84
        for md in self.mds:
85
            md.update(*others, **another)
86
            self.assertTrue(all(md[k] == upd[k] for k in self.replaced_keys))
87
            self.assertTrue(all(md["c"][k] == upd["c"][k] for k
88
                                in upd["c"].keys()))
89
            self.assertTrue(all(md[k] == ref[k] for k in ref.keys()
90
                                if k not in upd))
91
92
93
class Test_32_UpdateWithMergeDict_kept(Test_10_UpdateWithReplaceDict):