Ejemplo n.º 1
0
 def test_IntervalWidget_render(self):
     for format in ['DHMSX', 'DHMS', 'D', 'DH', 'DS', 'DX',
                     'HS', 'HX', 'HM', 'MS', 'MX', 'S', 'SX', 'D',
                     'H', 'M']:
         for value in [
             None,
             widgetParams(days=5),
             widgetParams(minutes=10, seconds=50),
             widgetParams(days=5, microseconds=5)]:
             w = IntervalWidget(format=format)
             w.render('foo', value)
Ejemplo n.º 2
0
 def test_IntervalWidget_render(self):
     for format in [
             'DHMSX', 'DHMS', 'D', 'DH', 'DS', 'DX', 'HS', 'HX', 'HM', 'MS',
             'MX', 'S', 'SX', 'D', 'H', 'M'
     ]:
         for value in [
                 None,
                 widgetParams(days=5),
                 widgetParams(minutes=10, seconds=50),
                 widgetParams(days=5, microseconds=5)
         ]:
             w = IntervalWidget(format=format)
             w.render('foo', value)
Ejemplo n.º 3
0
    def test_IntervalWidget_value_from_datadict(self):
        w = IntervalWidget()
        v = w.value_from_datadict(prepend("foo_", widgetParams()), [], 'foo')
        self.assertEqual(v, widgetParams())

        w = IntervalWidget('D')
        v = w.value_from_datadict(dict(foo_days='1'), [], 'foo')
        self.assertEqual(v, dict(days=1))

        w = IntervalWidget('D')
        v = w.value_from_datadict(dict(foo_days='X'), [], 'foo')
        self.assertEqual(v, dict(days='X', BAD='days'))
Ejemplo n.º 4
0
    def test_IntervalWidget_value_from_datadict(self):
        w = IntervalWidget()
        v = w.value_from_datadict(
            prepend("foo_", widgetParams()), [], 'foo'
        )
        self.assertEquals(v, widgetParams())

        w = IntervalWidget('D')
        v = w.value_from_datadict(
            dict(foo_days='1'), [], 'foo'
        )
        self.assertEquals(v, dict(days=1))

        w = IntervalWidget('D')
        v = w.value_from_datadict(
            dict(foo_days='X'), [], 'foo'
        )
        self.assertEquals(v, dict(days='X', BAD='days'))
Ejemplo n.º 5
0
 def test_IntervalWidget_render_incomplete(self):
     w = IntervalWidget(format='D')
     w.render('foo', timedelta(days=5))
Ejemplo n.º 6
0
 def test_IntervalWidget_render_incomplete(self):
     w = IntervalWidget(format='D')
     w.render('foo', timedelta(days=5))