Make facet methods chainable.
This commit is contained in:
parent
364bed871b
commit
a65ad6fce1
|
@ -70,13 +70,16 @@ class TextFacet(Facet):
|
|||
if s['v']['v'] == value:
|
||||
return
|
||||
self.selection.append({'v': {'v': value, 'l': value}})
|
||||
return self
|
||||
|
||||
def exclude(self, value):
|
||||
self.selection = [s for s in self.selection
|
||||
if s['v']['v'] != value]
|
||||
return self
|
||||
|
||||
def reset(self):
|
||||
self.selection = []
|
||||
return self
|
||||
|
||||
|
||||
class StarredFacet(TextFacet):
|
||||
|
|
|
@ -79,6 +79,8 @@ class FacetTest(unittest.TestCase):
|
|||
self.assertEqual(len(facet.selection), 1)
|
||||
facet.reset()
|
||||
self.assertEqual(len(facet.selection), 0)
|
||||
facet.include('element').include('element 2')
|
||||
self.assertEqual(len(facet.selection), 2)
|
||||
|
||||
def test_reset_remove(self):
|
||||
text_facet1 = TextFacet('column name')
|
||||
|
|
Loading…
Reference in New Issue