From d3bd69798b81e169e646527ff9254f7fda21559a Mon Sep 17 00:00:00 2001 From: Paul Makepeace Date: Mon, 25 Apr 2011 15:56:59 -0400 Subject: [PATCH] Add tests to complete section 4. --- google/test/test_refine.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/google/test/test_refine.py b/google/test/test_refine.py index 2c9ce73..c1aeaa9 100644 --- a/google/test/test_refine.py +++ b/google/test/test_refine.py @@ -297,6 +297,25 @@ class TutorialTestDuplicateDetection(RefineTestCase): response = self.project.get_rows() emails = [1 if r['email'] else 0 for r in response.rows] self.assertEqual(emails, [1, 0, 1, 1, 1, 0, 0, 1, 1, 0]) - + # {12} + blank_facet = TextFacet('email', expression='isBlank(value)', + selection=True) + # {13} + response = self.project.remove_rows(blank_facet) + self.assertTrue('Remove 4 rows' in + response['historyEntry']['description']) + self.project.engine.remove_all() + response = self.project.get_rows() + email_counts = [(row['email'], row['count']) for row in response.rows] + self.assertEqual(email_counts, [ + (u'arthur.duff@example4.com', 2), + (u'ben.morisson@example6.org', 1), + (u'ben.tyler@example3.org', 1), + (u'danny.baron@example1.com', 3), + (u'jean.griffith@example5.org', 1), + (u'melanie.white@example2.edu', 2) + ]) + + if __name__ == '__main__': unittest.main() \ No newline at end of file