Example #1
0
File: tests.py Project: thoas/nydus
    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'")
Example #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'")
Example #3
0
File: tests.py Project: thoas/nydus
 def test_command_error_returns_as_error(self):
     ec = EventualCommand('foo')
     ec.resolve_as(CommandError([ValueError('test')]))
     self.assertEqual(ec.is_error, True)
Example #4
0
File: tests.py Project: thoas/nydus
    def test_evaled_unicode(self):
        ec = EventualCommand('foo')
        ec.resolve_as('biz')

        self.assertEqual('%s' % ec, 'biz')
Example #5
0
File: tests.py Project: thoas/nydus
    def test_nonzero(self):
        ec = EventualCommand('foo')()
        ec.resolve_as(None)

        self.assertEqual(int(ec or 0), 0)
Example #6
0
File: tests.py Project: thoas/nydus
    def test_coersion(self):
        ec = EventualCommand('foo')()
        ec.resolve_as('5')

        self.assertEqual(int(ec), 5)
Example #7
0
File: tests.py Project: tupy/nydus
    def test_isinstance_check(self):
        ec = EventualCommand('foo')
        ec.resolve_as(['foo', 'bar'])

        self.assertEquals(isinstance(ec, list), True)
Example #8
0
    def test_evaled_unicode(self):
        ec = EventualCommand('foo')
        ec.resolve_as('biz')

        self.assertEquals(unicode(ec), u'biz')
Example #9
0
File: tests.py Project: tupy/nydus
 def test_command_error_returns_as_error(self):
     ec = EventualCommand('foo')
     ec.resolve_as(CommandError([ValueError('test')]))
     self.assertEquals(ec.is_error, True)
Example #10
0
File: tests.py Project: tupy/nydus
    def test_evaled_unicode(self):
        ec = EventualCommand('foo')
        ec.resolve_as('biz')

        self.assertEquals(unicode(ec), u'biz')
Example #11
0
File: tests.py Project: tupy/nydus
    def test_nonzero(self):
        ec = EventualCommand('foo')()
        ec.resolve_as(None)

        self.assertEquals(int(ec or 0), 0)
Example #12
0
File: tests.py Project: tupy/nydus
    def test_coersion(self):
        ec = EventualCommand('foo')()
        ec.resolve_as('5')

        self.assertEquals(int(ec), 5)
Example #13
0
File: tests.py Project: tupy/nydus
    def test_evaled_repr(self):
        ec = EventualCommand('foo')
        ec('bar', baz='foo')
        ec.resolve_as('biz')

        self.assertEquals(repr(ec), u"'biz'")
Example #14
0
    def test_evaled_unicode(self):
        ec = EventualCommand('foo')
        ec.resolve_as('biz')

        self.assertEqual('%s' % ec, 'biz')
Example #15
0
File: tests.py Project: thoas/nydus
 def test_other_error_does_not_return_as_error(self):
     ec = EventualCommand('foo')
     ec.resolve_as(ValueError('test'))
     self.assertEqual(ec.is_error, False)
Example #16
0
File: tests.py Project: tupy/nydus
 def test_other_error_does_not_return_as_error(self):
     ec = EventualCommand('foo')
     ec.resolve_as(ValueError('test'))
     self.assertEquals(ec.is_error, False)
Example #17
0
File: tests.py Project: thoas/nydus
    def test_isinstance_check(self):
        ec = EventualCommand('foo')
        ec.resolve_as(['foo', 'bar'])

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

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