From c716d9bd069272193ac16f64d6ec4ca14d378281 Mon Sep 17 00:00:00 2001 From: Ben Waugh Date: Wed, 10 Apr 2013 21:27:37 +0100 Subject: [PATCH] Add example of another Nose assertion to cheat sheet. --- testing/cheat-sheet.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/testing/cheat-sheet.md b/testing/cheat-sheet.md index 295801d..3047fca 100644 --- a/testing/cheat-sheet.md +++ b/testing/cheat-sheet.md @@ -46,7 +46,6 @@ By default, Nose will There are some additional rules, and you can configure your own, but this should be enough to get started. - ### A simple test from nose.tools import assert_equal @@ -60,7 +59,16 @@ There are some additional rules, and you can configure your own, but this should ### Other assertions -TODO: finish this +Nose provides a range of assertions that can be used when a test is not just checking a simple equality, e.g. + + from nose.tools import assert_items_equal + + from mycode import find_factors + + def test_6(): + observed = find_factors(6) + expected = [2, 3] + assert_items_equal(observed, expected) # order of factors is not guaranteed ### Floating point tests -- 2.26.2