@@ -267,10 +267,47 @@ def testAssertNotIn(self):
267267
268268    def  testAssertDictEqual (self ):
269269        self .assertMessages ('assertDictEqual' , ({}, {'key' : 'value' }),
270-                             [r"^\{\} != \{'key': 'value'\}\n\{\nKeys in the second dict but not the first:\n  \+ 'key': 'value',\n\}$" ,
270+                             [r"^\{\} != \{'key': 'value'\}\n\{\nKeys in the second " 
271+                              r"dict but not the first:\n  \+ 'key': 'value',\n\}$" ,
271272                             r"^oops$" ,
272-                              r"^\{\} != \{'key': 'value'\}\n\{\nKeys in the second dict but not the first:\n  \+ 'key': 'value',\n\}$" ,
273-                              r"^\{\} != \{'key': 'value'\}\n\{\nKeys in the second dict but not the first:\n  \+ 'key': 'value',\n\} : oops$" ])
273+                              r"^\{\} != \{'key': 'value'\}\n\{\nKeys in the second " 
274+                              r"dict but not the first:\n  \+ 'key': 'value',\n\}$" ,
275+                              r"^\{\} != \{'key': 'value'\}\n\{\nKeys in the second " 
276+                              r"dict but not the first:\n  \+ 'key': 'value',\n\} : oops$" ])
277+         self .assertDictEqual ({}, {})
278+         self .assertDictEqual ({'key' : 'value' }, {'key' : 'value' })
279+         self .assertRaisesRegex (
280+             AssertionError ,
281+             r"^\{\} != \{'key': 'value'\}\n{\nKeys in the second " 
282+             r"dict but not the first:\n  \+ 'key': 'value',\n}$" ,
283+             lambda : self .assertDictEqual ({}, {'key' : 'value' }))
284+         self .assertRaisesRegex (
285+             AssertionError ,
286+             r"^\{'key': 'value'\} != \{\}\n{\nKeys in the first " 
287+             r"dict but not the second:\n  - 'key': 'value',\n}$" ,
288+             lambda : self .assertDictEqual ({'key' : 'value' }, {}))
289+         self .assertRaisesRegex (
290+             AssertionError ,
291+             r"^\{'key': 'value'\} != \{'key': 'othervalue'\}\n{\nKeys in both dicts " 
292+             r"with differing values:\n  - 'key': 'value',\n  \+ 'key': 'othervalue',\n}$" ,
293+             lambda : self .assertDictEqual ({'key' : 'value' }, {'key' : 'othervalue' }))
294+         self .assertRaisesRegex (
295+             AssertionError ,
296+             r"^\{'same': 'same', 'samekey': 'onevalue', 'otherkey': 'othervalue'\} " 
297+             r"!= \{'same': 'same', 'samekey': 'twovalue', 'somekey': 'somevalue'\}\n{\n" 
298+             r"    'same': 'same',\n" 
299+             r"Keys in both dicts with differing values:\n" 
300+             r"  - 'samekey': 'onevalue',\n" 
301+             r"  \+ 'samekey': 'twovalue',\n" 
302+             r"Keys in the first dict but not the second:\n" 
303+             r"  - 'otherkey': 'othervalue',\n" 
304+             r"Keys in the second dict but not the first:\n" 
305+             r"  \+ 'somekey': 'somevalue',\n" 
306+             r"\}$" ,
307+             lambda : self .assertDictEqual (
308+                 {'same' : 'same' , 'samekey' : 'onevalue' , 'otherkey' : 'othervalue' },
309+                 {'same' : 'same' , 'samekey' : 'twovalue' , 'somekey' : 'somevalue' }))
310+ 
274311
275312    def  testAssertMultiLineEqual (self ):
276313        self .assertMessages ('assertMultiLineEqual' , ("" , "foo" ),
0 commit comments