def test_iter(self):
     ctx = Contexts()
     ctx.add(Context('foo'))
     # includes default contexts
     self.assertEqual(['default', 'foo', 'null'], sorted(list(ctx)))
 def test_contains(self):
     ctx = Contexts()
     ctx.add(Context('foo'))
     self.assertTrue('foo' in ctx)
     self.assertFalse('bar' in ctx)
 def test_keyerror(self):
     ctx = Contexts()
     ctx.add(Context('foo'))
     with self.assertRaises(KeyError):
         ctx['bar']
Example #4
0
 def test_iter(self):
     ctx = Contexts()
     ctx.add(Context('foo'))
     # includes default contexts
     self.assertEqual(['default', 'foo', 'null'], sorted(list(ctx)))
Example #5
0
 def test_contains(self):
     ctx = Contexts()
     ctx.add(Context('foo'))
     self.assertTrue('foo' in ctx)
     self.assertFalse('bar' in ctx)
Example #6
0
 def test_keyerror(self):
     ctx = Contexts()
     ctx.add(Context('foo'))
     with self.assertRaises(KeyError):
         ctx['bar']