Esempio 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))
Esempio 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))
Esempio 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))
Esempio 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)
Esempio 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)
Esempio 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))
Esempio 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))
Esempio 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))
Esempio 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)
Esempio 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)