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