MCPcopy Create free account
hub / github.com/apache/qpid-proton / testAnnotationDict

Method testAnnotationDict

python/tests/proton_tests/codec.py:277–295  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

275 assert a == b == c == d == e == f == g
276
277 def testAnnotationDict(self):
278 # AnnotationMap c'tor calls update(), so this method is also covered
279 a = AnnotationDict(one=1, two=2, three=3)
280 a[ulong(4)] = 'four'
281 b = AnnotationDict({'one': 1, 'two': 2, 'three': 3, ulong(4): 'four'})
282 c = AnnotationDict(zip(['one', 'two', 'three', ulong(4)], [1, 2, 3, 'four']))
283 d = AnnotationDict([('two', 2), ('one', 1), ('three', 3), (ulong(4), 'four')])
284 e = AnnotationDict({symbol('three'): 3, ulong(4): 'four', symbol('one'): 1, symbol('two'): 2})
285 f = AnnotationDict(a)
286 g = AnnotationDict()
287 g[ulong(4)] = 'four'
288 g['one'] = 1
289 g[symbol('two')] = 2
290 g['three'] = 3
291 assert a == b == c == d == e == f == g
292 for k in a.keys():
293 assert isinstance(k, (symbol, ulong))
294 self.assertRaises(KeyError, AnnotationDict, {'one': 1, None: 'none'})
295 self.assertRaises(KeyError, AnnotationDict, {'one': 1, 1.23: 4})
296
297 def testAnnotationDictNoRaiseError(self):
298 a = AnnotationDict(one=1, two=2, three=3, raise_on_error=False)

Callers

nothing calls this directly

Calls 4

AnnotationDictClass · 0.90
ulongClass · 0.90
symbolClass · 0.90
assertRaisesMethod · 0.80

Tested by

no test coverage detected