From 9759c2b51a1250aa345c21b7cc6b793f4965ac2d Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 28 May 2018 19:51:58 +0300 Subject: Add: BuildStateMachine class --- yarns/900-implements.yarn | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'yarns/900-implements.yarn') diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn index 4086a2f..5468a6c 100644 --- a/yarns/900-implements.yarn +++ b/yarns/900-implements.yarn @@ -108,17 +108,23 @@ along with this program. If not, see . expected_text = get_next_match() expected = json.loads(expected_text) actual = json.loads(vars['body']) - print('expected', json.dumps(expected, indent=4)) - print('actual', json.dumps(actual, indent=4)) + print 'expected' + json.dump(expected, sys.stdout, indent=4, sort_keys=True) + print + print 'actual' + json.dump(actual, sys.stdout, indent=4, sort_keys=True) + print diff = dict_diff(expected, actual) if diff is not None: print(diff) assert 0 - IMPLEMENTS THEN body text is "(.*)" - expected = unescape(get_next_match()) - actual = vars['body'] - assertEqual(expected, actual) + IMPLEMENTS THEN body text contains "(.*)" + pattern = unescape(get_next_match()) + text = vars['body'] + print 'pattern:', repr(pattern) + print 'text:', text + assertTrue(pattern in text) IMPLEMENTS THEN body is the same as the blob (\S+) filename = get_next_match() @@ -142,10 +148,10 @@ along with this program. If not, see . IMPLEMENTS THEN result is step (.+) step = json.loads(get_next_match()) - body = json.loads(vars['body']) - actual_step = body['step'] print('expected step', step) + body = json.loads(vars['body']) print('actual body', body) + actual_step = body['step'] print('actual step', actual_step) diff = dict_diff(step, actual_step) print('diff', diff) -- cgit v1.2.1