diff --git a/google/refine/facet.py b/google/refine/facet.py index edba48f..c76f29f 100644 --- a/google/refine/facet.py +++ b/google/refine/facet.py @@ -115,7 +115,7 @@ class NumericFacet(Facet): column, From=From, to=to, - expression=expression, + expression=expression, type='range', select_blank=select_blank, select_error=select_error, @@ -123,6 +123,11 @@ class NumericFacet(Facet): select_numeric=select_numeric, **options) + def reset(self): + self.From = None + self.to = None + return self + class FacetResponse(object): def __init__(self, facet): diff --git a/google/test/test_tutorial.py b/google/test/test_tutorial.py index 5eb63fa..3c0e978 100644 --- a/google/test/test_tutorial.py +++ b/google/test/test_tutorial.py @@ -421,6 +421,18 @@ class TutorialTestWebScraping(refinetest.RefineTestCase): self.assertEqual(len(rows), 2) self.assertEqual(rows[-1]['top'], 567) self.project.engine.remove_all() + # {5} - tutorial says 'line'; it means 'top' + line_facet = facet.NumericFacet('top') + line_facet.to = 100 + self.project.remove_rows(line_facet) + self.assertInResponse('Remove 775 rows') + line_facet.From = 570 + line_facet.to = 600 + self.project.remove_rows(line_facet) + self.assertInResponse('Remove 71 rows') + line_facet.reset() + response = self.project.get_rows() + self.assertEqual(response.filtered, 4563) if __name__ == '__main__':