コード例 #1
0
ファイル: test_status.py プロジェクト: vanzhiganov/rtmpy
    def test_status(self):
        """
        Ensure that L{statust.fromFailure} works as expected
        """
        f = self.buildFailure(TestRuntimeError, 'foo bar')

        s = status.fromFailure(f)

        self.assertTrue(status.IStatus.providedBy(s))
        self.assertEqual(s.level, 'error')
        self.assertEqual(s.code, None)
        self.assertEqual(s.description, 'foo bar')
コード例 #2
0
ファイル: test_status.py プロジェクト: Arlex/rtmpy
    def test_status(self):
        """
        Ensure that L{statust.fromFailure} works as expected
        """
        f = self.buildFailure(TestRuntimeError, 'foo bar')

        s = status.fromFailure(f)

        self.assertTrue(status.IStatus.providedBy(s))
        self.assertEqual(s.level, 'error')
        self.assertEqual(s.code, None)
        self.assertEqual(s.description, 'foo bar')
コード例 #3
0
ファイル: test_status.py プロジェクト: vanzhiganov/rtmpy
    def test_default_code(self):
        """
        L{status.fromFailure} looks for a C{code} attribute on the exception
        instance contained in the failure. If one is not present, supplying a
        default code is allowed.
        """
        f = self.buildFailure(RuntimeError, 'spam eggs')

        self.assertFalse(hasattr(f.value, 'code'))

        s = status.fromFailure(f, 'default code')

        self.assertTrue(status.IStatus.providedBy(s))
        self.assertEqual(s.level, 'error')
        self.assertEqual(s.code, 'default code')
        self.assertEqual(s.description, 'spam eggs')
コード例 #4
0
ファイル: test_status.py プロジェクト: Arlex/rtmpy
    def test_default_code(self):
        """
        L{status.fromFailure} looks for a C{code} attribute on the exception
        instance contained in the failure. If one is not present, supplying a
        default code is allowed.
        """
        f = self.buildFailure(RuntimeError, 'spam eggs')

        self.assertFalse(hasattr(f.value, 'code'))

        s = status.fromFailure(f, 'default code')

        self.assertTrue(status.IStatus.providedBy(s))
        self.assertEqual(s.level, 'error')
        self.assertEqual(s.code, 'default code')
        self.assertEqual(s.description, 'spam eggs')