Exemplo n.º 1
0
 def test_can_specify_custom_message(self):
     assertion = lambda: assert_dict_contains(dict(foo='bar'), dict(foo='baz'))
     exception = assert_raises(AssertionError, assertion)
     assert_equals("'foo':'bar' not in {'foo': 'baz'}", exception_message(exception))
Exemplo n.º 2
0
 def test_has_sensible_default_error_message(self):
     assertion = lambda: assert_dict_contains(dict(definitely_missing='from other dict'), dict())
     exception = assert_raises(AssertionError, assertion)
     assert_equals("'definitely_missing':'from other dict' not in {}", exception_message(exception))
Exemplo n.º 3
0
 def test_has_sensible_default_error_message_when_values_differ(self):
     assertion = lambda: assert_dict_contains(dict(foo='bar'), dict(foo='baz'))
     exception = assert_raises(AssertionError, assertion)
     assert_equals("'foo':'bar' not in {'foo': 'baz'}", exception_message(exception))
Exemplo n.º 4
0
 def test_can_detect_contained_dict(self):
     sub_dict = dict(foo='bar')
     super_dict = dict(foo='bar', bar='baz')
     assert_dict_contains(sub_dict, super_dict)
Exemplo n.º 5
0
 def test_throws_if_dict_is_not_contained(self):
     assertion = lambda: assert_dict_contains(dict(not_in='other dict'), dict())
     assert_raises(AssertionError, assertion)
Exemplo n.º 6
0
 def test_can_specify_custom_message(self):
     assertion = lambda: assert_dict_contains(dict(foo='bar'),
                                              dict(foo='baz'))
     exception = assert_raises(AssertionError, assertion)
     assert_equals("'foo':'bar' not in {'foo': 'baz'}",
                   exception_message(exception))
Exemplo n.º 7
0
 def test_has_sensible_default_error_message_when_values_differ(self):
     assertion = lambda: assert_dict_contains(dict(foo='bar'),
                                              dict(foo='baz'))
     exception = assert_raises(AssertionError, assertion)
     assert_equals("'foo':'bar' not in {'foo': 'baz'}",
                   exception_message(exception))
Exemplo n.º 8
0
 def test_has_sensible_default_error_message(self):
     assertion = lambda: assert_dict_contains(
         dict(definitely_missing='from other dict'), dict())
     exception = assert_raises(AssertionError, assertion)
     assert_equals("'definitely_missing':'from other dict' not in {}",
                   exception_message(exception))
Exemplo n.º 9
0
 def test_throws_if_dict_is_not_contained(self):
     assertion = lambda: assert_dict_contains(dict(not_in='other dict'),
                                              dict())
     assert_raises(AssertionError, assertion)
Exemplo n.º 10
0
 def test_can_detect_contained_dict(self):
     sub_dict = dict(foo='bar')
     super_dict = dict(foo='bar', bar='baz')
     assert_dict_contains(sub_dict, super_dict)