def test_load(self): config_data = loader.ObjectConfiguration(StubObject) assert_equal(config_data['year'], 2012) assert_equal(config_data['month'], 3) assert_equal(config_data['hour'], 15) assert_not_in('_private', config_data) assert_not_in('__really_private', config_data)
def test_deprecated_msg_param(self): with warnings.catch_warnings(record=True) as w: assertions.assert_not_in(3, [1, 2], msg="This is a message") assertions.assert_equal(len(w), 1) assert issubclass(w[-1].category, DeprecationWarning) assertions.assert_in("msg is deprecated", str(w[-1].message))
def test(self): super(TestCase, self).test() before_the_block_index = self.result.find('before_the_block') outer_block_index = self.result.find('outer_block') asdf_index = self.result.find('asdf') inner_block_index = self.result.find('inner_block') bsdf_index = self.result.find('bsdf') indices = (before_the_block_index, outer_block_index, asdf_index, inner_block_index, bsdf_index) assert_not_in(-1, indices) for i in xrange(1, len(indices)): assert_lt(indices[i-1], indices[i])
def test_clear(self): self.store.clear() assert_not_in(self.node, self.store)
def test_clear(self): self.repo.clear() assert_not_in(self.node, self.repo.nodes) assert_not_in(self.node, self.repo.pools)
def test_message_param_not_deprecated(self): with warnings.catch_warnings(record=True) as w: assertions.assert_not_in(3, [1, 2], message="This is a message") assertions.assert_equal(len(w), 0)
def test_add_contains(self): autospec_method(self.collection.contains_item) item, update_func = mock.Mock(), mock.Mock() assert not self.collection.add(item, update_func) assert_not_in(item.get_name(), self.collection)
def test_remove(self): name = 'the_name' self.collection[name] = item = mock.Mock() self.collection.remove(name) assert_not_in(name, self.collection) item.disable.assert_called_with()
def test__contains__(self): assert_in('one', self.enum) assert_in('two', self.enum) assert_in('three', self.enum) assert_not_in('four', self.enum) assert_not_in('zero', self.enum)