MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_update

Method test_update

Lib/test/test_http_cookies.py:494–519  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

492 self.assertNotIn('invalid', morsel)
493
494 def test_update(self):
495 attribs = {'expires': 1, 'Version': 2, 'DOMAIN': 'example.com'}
496 # test dict update
497 morsel = cookies.Morsel()
498 morsel.update(attribs)
499 self.assertEqual(morsel['expires'], 1)
500 self.assertEqual(morsel['version'], 2)
501 self.assertEqual(morsel['domain'], 'example.com')
502 # test iterable update
503 morsel = cookies.Morsel()
504 morsel.update(list(attribs.items()))
505 self.assertEqual(morsel['expires'], 1)
506 self.assertEqual(morsel['version'], 2)
507 self.assertEqual(morsel['domain'], 'example.com')
508 # test iterator update
509 morsel = cookies.Morsel()
510 morsel.update((k, v) for k, v in attribs.items())
511 self.assertEqual(morsel['expires'], 1)
512 self.assertEqual(morsel['version'], 2)
513 self.assertEqual(morsel['domain'], 'example.com')
514
515 with self.assertRaises(cookies.CookieError):
516 morsel.update({'invalid': 'value'})
517 self.assertNotIn('invalid', morsel)
518 self.assertRaises(TypeError, morsel.update)
519 self.assertRaises(TypeError, morsel.update, 0)
520
521 def test_pickle(self):
522 morsel_a = cookies.Morsel()

Callers

nothing calls this directly

Calls 6

updateMethod · 0.95
listClass · 0.85
assertNotInMethod · 0.80
assertEqualMethod · 0.45
itemsMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected