-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This patch looks good to me. acked. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlJqyjwACgkQrlYvE4MpobPOrACfXpHHSoNEDHytIY+7ium4lYFD OYMAoL4Ssd2HQadUHpviHTxsK96av8Go =GExO -----END PGP SIGNATURE-----
>From f240e8fd74ea5411d4036204000801ba0bebd834 Mon Sep 17 00:00:00 2001 From: Dan Walsh <dwalsh@xxxxxxxxxx> Date: Fri, 25 Oct 2013 14:53:15 -0400 Subject: [PATCH 02/11] Sven Vermeulen patch to fix sepolgen test code ====================================================================== FAIL: test_append (test_matching.TestMatchList) ---------------------------------------------------------------------- Traceback (most recent call last): File "/var/portage/portage/dev-python/sepolgen-1.1.9-r1/work/sepolgen-1.1.9-2.7/tests/test_matching.py", line 94, in test_append self.assertEqual(len(ml), 1) AssertionError: 2 != 1 From the test code, it looks like we use the matchlist length as a way to deduce if an .append() did the right thing or not (i.e. add to bastards or children). However, the length for the matchlist is defined as the sum of the lengths of both: def __len__(self): # Only return the length of the matches so # that this can be used to test if there is # a match. return len(self.children) + len(self.bastards) As a result, the len(ml) should always increase with an append, and then check the length of one of the two sublists (children or bastards) to find out if this occurred in the right sublist. --- sepolgen/tests/test_matching.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sepolgen/tests/test_matching.py b/sepolgen/tests/test_matching.py index 161e001..ca3f871 100644 --- a/sepolgen/tests/test_matching.py +++ b/sepolgen/tests/test_matching.py @@ -51,7 +51,7 @@ class TestMatchList(unittest.TestCase): a = matching.Match() a.dist = 100 ml.append(a) - self.assertEqual(len(ml), 1) + self.assertEqual(len(ml), 2) a = matching.Match() a.dist = 200 -- 1.8.3.1