Add NumericFacet.reset that clears the range (from, to)

This commit is contained in:
Paul Makepeace 2011-04-26 19:31:10 -04:00
parent dbe0ba518a
commit a0e4ce60e8
2 changed files with 18 additions and 1 deletions

View File

@ -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):

View File

@ -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__':