def __init__(self, version, support=None, session=None): super(ConnectMessage, self).__init__() self._version = version self._support = default(support, [version]) self._session = session if self._version not in self._support: raise ValueError('support must contain version')
def test_given_object_given_value_given_factory(self): with self.assertRaises(ValueError): default(self.obj, value=self.value, factory=self.factory)
def test_given_factory(self): self.assertEqual(default(None, factory=self.factory), self.factory_value)
def test_given_value(self): self.assertEqual(default(None, value=self.value), self.value)
def test_given_object_given_factory(self): self.assertEqual(default(self.obj, factory=self.factory), self.obj)
def test_given_object_given_value(self): self.assertEqual(default(self.obj, value=self.value), self.obj)