Пример #1
0
    def test_evaled_repr(self):
        ec = EventualCommand('foo')
        ec('bar', baz='foo')
        ec.resolve_as('biz')

        if PY2:
            self.assertEqual(repr(ec), "u'biz'")
        else:
            self.assertEqual(repr(ec), "'biz'")
Пример #2
0
    def test_evaled_repr(self):
        ec = EventualCommand('foo')
        ec('bar', baz='foo')
        ec.resolve_as('biz')

        if PY2:
            self.assertEqual(repr(ec), "u'biz'")
        else:
            self.assertEqual(repr(ec), "'biz'")
Пример #3
0
 def test_command_error_returns_as_error(self):
     ec = EventualCommand('foo')
     ec.resolve_as(CommandError([ValueError('test')]))
     self.assertEqual(ec.is_error, True)
Пример #4
0
    def test_evaled_unicode(self):
        ec = EventualCommand('foo')
        ec.resolve_as('biz')

        self.assertEqual('%s' % ec, 'biz')
Пример #5
0
    def test_nonzero(self):
        ec = EventualCommand('foo')()
        ec.resolve_as(None)

        self.assertEqual(int(ec or 0), 0)
Пример #6
0
    def test_coersion(self):
        ec = EventualCommand('foo')()
        ec.resolve_as('5')

        self.assertEqual(int(ec), 5)
Пример #7
0
    def test_isinstance_check(self):
        ec = EventualCommand('foo')
        ec.resolve_as(['foo', 'bar'])

        self.assertEquals(isinstance(ec, list), True)
Пример #8
0
    def test_evaled_unicode(self):
        ec = EventualCommand('foo')
        ec.resolve_as('biz')

        self.assertEquals(unicode(ec), u'biz')
Пример #9
0
 def test_command_error_returns_as_error(self):
     ec = EventualCommand('foo')
     ec.resolve_as(CommandError([ValueError('test')]))
     self.assertEquals(ec.is_error, True)
Пример #10
0
    def test_evaled_unicode(self):
        ec = EventualCommand('foo')
        ec.resolve_as('biz')

        self.assertEquals(unicode(ec), u'biz')
Пример #11
0
    def test_nonzero(self):
        ec = EventualCommand('foo')()
        ec.resolve_as(None)

        self.assertEquals(int(ec or 0), 0)
Пример #12
0
    def test_coersion(self):
        ec = EventualCommand('foo')()
        ec.resolve_as('5')

        self.assertEquals(int(ec), 5)
Пример #13
0
    def test_evaled_repr(self):
        ec = EventualCommand('foo')
        ec('bar', baz='foo')
        ec.resolve_as('biz')

        self.assertEquals(repr(ec), u"'biz'")
Пример #14
0
    def test_evaled_unicode(self):
        ec = EventualCommand('foo')
        ec.resolve_as('biz')

        self.assertEqual('%s' % ec, 'biz')
Пример #15
0
 def test_other_error_does_not_return_as_error(self):
     ec = EventualCommand('foo')
     ec.resolve_as(ValueError('test'))
     self.assertEqual(ec.is_error, False)
Пример #16
0
 def test_other_error_does_not_return_as_error(self):
     ec = EventualCommand('foo')
     ec.resolve_as(ValueError('test'))
     self.assertEquals(ec.is_error, False)
Пример #17
0
    def test_isinstance_check(self):
        ec = EventualCommand('foo')
        ec.resolve_as(['foo', 'bar'])

        self.assertEqual(isinstance(ec, list), True)
Пример #18
0
    def test_evaled_repr(self):
        ec = EventualCommand('foo')
        ec('bar', baz='foo')
        ec.resolve_as('biz')

        self.assertEquals(repr(ec), u"'biz'")