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