Exemplo n.º 1
0
 def testToggleItem(self):
     cc = CategoricalCondition(data=self.table, attr='fake_cat')
     cc.add_category(['C1', 'C3'])
     cc.toggle_category('C1')
     cc.toggle_category('C2')
     self.assertEqual(set(cc.included_categories()), set(['C3', 'C2']))
     cc.toggle_category(['C2','C4'])
     self.assertEqual(set(cc.included_categories()), set(['C3', 'C4']))
Exemplo n.º 2
0
 def testExcludeAll(self):
     cc = CategoricalCondition(data=self.table, attr='fake_cat')
     cc.add_category('C1')
     cc.exclude_all()
     self.assertEqual(cc.included_categories(),[])
Exemplo n.º 3
0
 def testIncludeAll(self):
     cc = CategoricalCondition(data=self.table, attr='fake_cat')
     cc.include_all()
     self.assertSetEqual(set(cc.included_categories()),
                         set(self.table.distinct('fake_cat')))
Exemplo n.º 4
0
 def testRemove(self):
     cc = CategoricalCondition(data=self.table, attr='fake_cat')
     cc.add_category(['C1', 'C3'])
     cc.remove_category('C1')
     self.assertEqual(set(cc.included_categories()), set(['C3']))
Exemplo n.º 5
0
    def testCreation(self):
        cc = CategoricalCondition(data=self.table, attr='fake_cat')
        self.assertEqual(cc.included_categories(), [])

        with self.assertRaises(NotImplementedError):
            cc = CategoricalCondition(data=self.table, attr='Information')