def test_double_in_out(self): a = Gtk.HSV() a.set_color(0.25, 0.5, 1) a.set_color(0.25, 0.5, _compat.long_type(1)) a.set_color(0.25, 0.5, 0.75) a.set_color(0.25, 0.5, True) self.assertRaises(TypeError, a.set_color, 0, 0, "") self.assertRaises(TypeError, a.set_color, 0, 0, None) self.assertEqual(a.get_color(), (0.25, 0.5, 1))
def test_uint32_in_out(self): a = Gtk.Alignment() self.assertEqual(a.get_padding(), (0, 0, 0, 0)) a.set_padding(1, 2, 3, 4) self.assertEqual(a.get_padding(), (1, 2, 3, 4)) a.set_padding(1, 2, 3, 2**32-1) a.set_padding(1, 2, 3, _compat.long_type(4)) a.set_padding(1, 2, 3, 1.9) self.assertEqual(a.get_padding(), (1, 2, 3, 1)) self.assertRaises(TypeError, a.set_padding, 1, 2, 3, "") self.assertRaises(TypeError, a.set_padding, 1, 2, 3, "1") self.assertRaises(TypeError, a.set_padding, 1, 2, 3, []) self.assertRaises(TypeError, a.set_padding, 1, 2, 3, None) self.assertRaises(tests.GIOverflowError, a.set_padding, 1, 2, 3, -1) self.assertRaises(TypeError, a.set_padding, 1, 2, 3, 2+1j) self.assertRaises(tests.GIOverflowError, a.set_padding, 1, 2, 3, 2**32)
def test_uint32_in_out(self): a = Gtk.Alignment() self.assertEqual(a.get_padding(), (0, 0, 0, 0)) a.set_padding(1, 2, 3, 4) self.assertEqual(a.get_padding(), (1, 2, 3, 4)) a.set_padding(1, 2, 3, 2**32 - 1) a.set_padding(1, 2, 3, _compat.long_type(4)) a.set_padding(1, 2, 3, 1.9) self.assertEqual(a.get_padding(), (1, 2, 3, 1)) self.assertRaises(TypeError, a.set_padding, 1, 2, 3, "") self.assertRaises(TypeError, a.set_padding, 1, 2, 3, "1") self.assertRaises(TypeError, a.set_padding, 1, 2, 3, []) self.assertRaises(TypeError, a.set_padding, 1, 2, 3, None) self.assertRaises(tests.GIOverflowError, a.set_padding, 1, 2, 3, -1) self.assertRaises(TypeError, a.set_padding, 1, 2, 3, 2 + 1j) self.assertRaises(tests.GIOverflowError, a.set_padding, 1, 2, 3, 2**32)