Ejemplo n.º 1
0
 def test_I(self):
     from _testcapi import getargs_I
     self.assertRaises(TypeError, getargs_I, 3.14)
     self.assertEqual(99, getargs_I(Int()))
     self.assertEqual(0, getargs_I(IntSubclass()))
     self.assertRaises(TypeError, getargs_I, BadInt())
     with self.assertWarns(DeprecationWarning):
         self.assertEqual(1, getargs_I(BadInt2()))
     self.assertEqual(0, getargs_I(BadInt3()))
     self.assertEqual(UINT_MAX, getargs_I(-1))
     self.assertEqual(0, getargs_I(0))
     self.assertEqual(UINT_MAX, getargs_I(UINT_MAX))
     self.assertEqual(0, getargs_I(UINT_MAX + 1))
     self.assertEqual(42, getargs_I(42))
     self.assertEqual(VERY_LARGE & UINT_MAX, getargs_I(VERY_LARGE))
Ejemplo n.º 2
0
    def test_I(self):
        from _testcapi import getargs_I
        # I returns 'unsigned int', no range checking
        self.assertRaises(TypeError, getargs_I, 3.14)
        self.assertEqual(99, getargs_I(Long()))
        self.assertEqual(99, getargs_I(Int()))

        self.assertEqual(UINT_MAX, getargs_I(-1))
        self.assertEqual(0, getargs_I(0))
        self.assertEqual(UINT_MAX, getargs_I(UINT_MAX))
        self.assertEqual(0, getargs_I(UINT_MAX+1))

        self.assertEqual(42, getargs_I(42))
        self.assertEqual(42, getargs_I(42L))

        self.assertEqual(VERY_LARGE & UINT_MAX, getargs_I(VERY_LARGE))
Ejemplo n.º 3
0
    def test_I(self):
        from _testcapi import getargs_I
        # I returns 'unsigned int', no range checking
        self.assertRaises(TypeError, getargs_I, 3.14)
        self.assertEqual(99, getargs_I(Int()))
        self.assertEqual(0, getargs_I(IntSubclass()))
        self.assertRaises(TypeError, getargs_I, BadInt())
        self.assertEqual(1, getargs_I(BadInt2()))
        self.assertEqual(0, getargs_I(BadInt3()))

        self.assertEqual(UINT_MAX, getargs_I(-1))
        self.assertEqual(0, getargs_I(0))
        self.assertEqual(UINT_MAX, getargs_I(UINT_MAX))
        self.assertEqual(0, getargs_I(UINT_MAX + 1))

        self.assertEqual(42, getargs_I(42))

        self.assertEqual(VERY_LARGE & UINT_MAX, getargs_I(VERY_LARGE))
Ejemplo n.º 4
0
    def test_I(self):
        from _testcapi import getargs_I
        # I returns 'unsigned int', no range checking
        self.assertRaises(TypeError, getargs_I, 3.14)
        self.assertEqual(99, getargs_I(Int()))
        self.assertEqual(0, getargs_I(IntSubclass()))
        self.assertRaises(TypeError, getargs_I, BadInt())
        with self.assertWarns(DeprecationWarning):
            self.assertEqual(1, getargs_I(BadInt2()))
        self.assertEqual(0, getargs_I(BadInt3()))

        self.assertEqual(UINT_MAX, getargs_I(-1))
        self.assertEqual(0, getargs_I(0))
        self.assertEqual(UINT_MAX, getargs_I(UINT_MAX))
        self.assertEqual(0, getargs_I(UINT_MAX+1))

        self.assertEqual(42, getargs_I(42))

        self.assertEqual(VERY_LARGE & UINT_MAX, getargs_I(VERY_LARGE))
    def test_I(self):
        from _testcapi import getargs_I
        # I returns 'unsigned int', no range checking
        self.failUnlessEqual(3, getargs_I(3.14))
        self.failUnlessEqual(99, getargs_I(Long()))
        self.failUnlessEqual(99, getargs_I(Int()))

        self.failUnlessEqual(UINT_MAX, getargs_I(-1))
        self.failUnlessEqual(0, getargs_I(0))
        self.failUnlessEqual(UINT_MAX, getargs_I(UINT_MAX))
        self.failUnlessEqual(0, getargs_I(UINT_MAX + 1))

        self.failUnlessEqual(42, getargs_I(42))
        self.failUnlessEqual(42, getargs_I(42L))

        self.failUnlessEqual(VERY_LARGE & UINT_MAX, getargs_I(VERY_LARGE))
Ejemplo n.º 6
0
    def test_I(self):
        from _testcapi import getargs_I
        # I returns 'unsigned int', no range checking
        self.failUnlessEqual(3, getargs_I(3.14))
        self.failUnlessEqual(99, getargs_I(Long()))
        self.failUnlessEqual(99, getargs_I(Int()))

        self.failUnlessEqual(UINT_MAX, getargs_I(-1))
        self.failUnlessEqual(0, getargs_I(0))
        self.failUnlessEqual(UINT_MAX, getargs_I(UINT_MAX))
        self.failUnlessEqual(0, getargs_I(UINT_MAX+1))

        self.failUnlessEqual(42, getargs_I(42))
        self.failUnlessEqual(42, getargs_I(42L))

        self.failUnlessEqual(VERY_LARGE & UINT_MAX, getargs_I(VERY_LARGE))