def test_assert_expected_value_ok(self): tests = [(False, False), (1, 1), ('a', 'a'), (3.14, 3.14), ([1, 'a'], [1, 'a']), ({ 'a': 'A', 'b': 'B' }, { 'b': 'B', 'a': 'A' }), (TestLinkedList('A', TestLinkedList('B')), TestLinkedList('A', TestLinkedList('B'))), (None, None), (dict.__class__, dict.__class__)] for spec in tests: JsonSnapshotHelper.AssertExpectedValue(spec[0], spec[1]) tests = [(False, True), (1, 2), ('a', 'b'), (3.14, -3.14), ([1, 'a'], ['a', 1]), ([1, 'a'], [1, 'a', 2]), ({ 'a': 'A', 'b': 'B' }, { 'a': 'A', 'b': 'B', 'c': 'C' }), (TestLinkedList('A', TestLinkedList('B')), TestLinkedList('A', TestLinkedList('C'))), (None, False), (dict, dict.__class__)] for spec in tests: self.assertRaises(AssertionError, JsonSnapshotHelper.AssertExpectedValue, spec[0], spec[1])
def assertEqual(self, expect, have, msg=''): if not isinstance(expect, JsonSnapshotableEntity): super(JsonValueObservationVerifierTest, self).assertEqual(expect, have, msg) return try: JsonSnapshotHelper.AssertExpectedValue(expect, have, msg) except AssertionError: print 'EXPECTED\n{0!r}\nGOT\n{1!r}'.format(expect, have)
def assertEqual(self, expect, have, msg=''): JsonSnapshotHelper.AssertExpectedValue(expect, have, msg)
def assertEqual(self, expect, have, msg=''): if not msg: msg = 'EXPECTED\n{0!r}\nGOT\n{1!r}'.format(expect, have) JsonSnapshotHelper.AssertExpectedValue(expect, have, msg)
def assertEqual(self, expect, have, msg=''): try: JsonSnapshotHelper.AssertExpectedValue(expect, have, msg) except AssertionError: print '\nEXPECT\n{0!r}\n\nGOT\n{1!r}\n'.format(expect, have) raise