def test_call_accept(self): ch = handlers.choice('foo', 'bar', 'baz') self.assertEqual(ch('foo'), 'foo') self.assertEqual(ch('bar'), 'bar') self.assertEqual(ch('baz'), 'baz')
def test_call_reject(self): ch = handlers.choice('foo', 'bar', 'baz') self.assertRaises(ValueError, ch, 'spam')
def test_init(self): ch = handlers.choice('foo', 'bar', 'baz') self.assertEqual(ch.choices, set(['foo', 'bar', 'baz']))