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)
示例#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))
示例#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)
示例#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])
示例#6
0
文件: node_test.py 项目: Bklyn/Tron
 def test_clear(self):
     self.store.clear()
     assert_not_in(self.node, self.store)
示例#7
0
文件: node_test.py 项目: kesre/Tron
 def test_clear(self):
     self.repo.clear()
     assert_not_in(self.node, self.repo.nodes)
     assert_not_in(self.node, self.repo.pools)
示例#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)
示例#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)
示例#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)
示例#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()
示例#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)
示例#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)
示例#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()
示例#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)
示例#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)