예제 #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']