Esempio n. 1
0
    def test_nonzero(self):
        f = FilterSpec(value='abc')
        self.assertEqual(bool(f), True)

        f = FilterSpec()
        self.assertEqual(bool(f), False)

        f = FilterSpec(value='')
        self.assertEqual(bool(f), False)
Esempio n. 2
0
 def test_get_filter_description(self):
     f = FilterSpec(value='abc')
     self.assertEqual(f.get_filter_description('char'), "abc")
Esempio n. 3
0
 def test_get_filter(self):
     f = FilterSpec(value='abc')
     self.assertEqual(f.get_filter(), 'abc')
Esempio n. 4
0
    def test_init(self):
        f = FilterSpec()
        self.assertEqual(f._value, {})

        f = FilterSpec(value='abc')
        self.assertEqual(f._value, 'abc')
Esempio n. 5
0
 def test_get_filters_summary_filterspec(self):
     r = FilterSpecDemoReport.as_report()
     form = reportform_factory(r, (r.config_form_class, ))()
     form.cleaned_data = {'date_range': FilterSpec('2001')}
     self.assertEqual(form.get_filters_summary(), {u'Date Range': '2001'})
Esempio n. 6
0
 def test_get_filters_filterspec_dict(self):
     r = FilterSpecDemoReport.as_report()
     form = reportform_factory(r, (r.config_form_class, ))()
     form.cleaned_data = {'date_range': FilterSpec({1: '2001'})}
     f = form.get_filters()
     self.assertSequenceEqual(([], {1: '2001'}), f)
Esempio n. 7
0
 def test_get_filter(self):
     f = FilterSpec(value='abc')
     self.assertEqual(f.get_filter(), 'abc')
Esempio n. 8
0
 def test_get_filter_description(self):
     f = FilterSpec(value='abc')
     self.assertEqual(f.get_filter_description('char'), "abc")