Add tests for selection faceting for section {8}
This commit is contained in:
parent
c7b445e851
commit
a2fa25d4e4
|
@ -80,8 +80,8 @@ class TutorialTestFacets(RefineTestCase):
|
|||
def test_basic_facet(self):
|
||||
# {4}
|
||||
facet = Facet(column='Party Code')
|
||||
facets = self.project.text_facet(facet)
|
||||
pc = facets.facets[0]
|
||||
response = self.project.text_facet(facet)
|
||||
pc = response.facets[0]
|
||||
self.assertEqual(pc.name, 'Party Code')
|
||||
self.assertEqual(pc.choices['D'].count, 3700)
|
||||
self.assertEqual(pc.choices['N'].count, 15)
|
||||
|
@ -91,17 +91,24 @@ class TutorialTestFacets(RefineTestCase):
|
|||
ethnicity_facet = Facet(column='Ethnicity')
|
||||
engine.add_facet(ethnicity_facet)
|
||||
self.project.engine = engine
|
||||
facets = self.project.text_facet()
|
||||
e = facets.facets[1]
|
||||
response = self.project.text_facet()
|
||||
e = response.facets[1]
|
||||
self.assertEqual(e.choices['B'].count, 1255)
|
||||
self.assertEqual(e.choices['W'].count, 4469)
|
||||
# {7}
|
||||
ethnicity_facet.include('B')
|
||||
facets = self.project.text_facet()
|
||||
response = self.project.get_rows()
|
||||
self.assertEqual(response.filtered, 1255)
|
||||
indexes = [r.index for r in response.rows]
|
||||
self.assertEqual(indexes, [1, 2, 3, 4, 6, 12, 18, 26, 28, 32])
|
||||
# {8}
|
||||
response = self.project.text_facet()
|
||||
pc = response.facets[0]
|
||||
self.assertEqual(pc.name, 'Party Code')
|
||||
self.assertEqual(pc.choices['D'].count, 1179)
|
||||
self.assertEqual(pc.choices['R'].count, 11)
|
||||
self.assertEqual(pc.blank_choice.count, 46)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
Reference in New Issue