Add NumericFacet.reset that clears the range (from, to)
This commit is contained in:
parent
dbe0ba518a
commit
a0e4ce60e8
|
@ -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):
|
||||
|
|
|
@ -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__':
|
||||
|
|
Loading…
Reference in New Issue