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)
Exemplo n.º 2
0
    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))
Exemplo n.º 3
0
    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_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)
Exemplo n.º 5
0
    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])
Exemplo n.º 6
0
 def test_clear(self):
     self.store.clear()
     assert_not_in(self.node, self.store)
Exemplo n.º 7
0
 def test_clear(self):
     self.repo.clear()
     assert_not_in(self.node, self.repo.nodes)
     assert_not_in(self.node, self.repo.pools)
Exemplo n.º 8
0
    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)
Exemplo n.º 9
0
 def test_clear(self):
     self.repo.clear()
     assert_not_in(self.node, self.repo.nodes)
     assert_not_in(self.node, self.repo.pools)
Exemplo n.º 10
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)
Exemplo n.º 11
0
 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()
Exemplo n.º 12
0
 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)
Exemplo n.º 13
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)
Exemplo n.º 14
0
 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()
Exemplo n.º 15
0
 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)
Exemplo n.º 16
0
    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)