def test_raise_errors(self): """Check for raises errors """ # Checks for diferents instances with self.assertRaises(TypeError): r1 = Rectangle() with self.assertRaises(NameError): r1 = Rectangle_shape() with self.assertRaises(AttributeError): r1 = Rectangle(10, 80) r1.to_json() with self.assertRaises(TypeError): r2 = Rectangle(10) with self.assertRaises(ValueError): r3 = Rectangle(10, -4) with self.assertRaises(ValueError): r4 = Rectangle(-10, 4) with self.assertRaises(TypeError): r5 = Rectangle(10, "4") with self.assertRaises(TypeError): r6 = Rectangle("10", 4) with self.assertRaises(TypeError): r7 = Rectangle(10, 4, "9") with self.assertRaises(TypeError): r8 = Rectangle(10, 4, 9, "20") with self.assertRaises(ValueError): r9 = Rectangle(10, 4, -5, 7) with self.assertRaises(ValueError): r10 = Rectangle(10, 4, 5, -10) with self.assertRaises(TypeError): r11 = Rectangle(10, 4, 5, 10, 30, 60) with self.assertRaises(ValueError): r12 = Rectangle(0, 10) with self.assertRaises(ValueError): r13 = Rectangle(15, 0) # Checks for setters with self.assertRaises(TypeError): r1.x = "4" with self.assertRaises(ValueError): r1.x = -4 with self.assertRaises(ValueError): r1.width = -10 with self.assertRaises(TypeError): r1.width = "10" with self.assertRaises(TypeError): r1.height = "30" with self.assertRaises(ValueError): r1.height = -10 with self.assertRaises(TypeError): r1.y = "10" with self.assertRaises(ValueError): r1.y = -10 # Checks for update method with self.assertRaises(ValueError): r1.update(10, -10, 20, 40) with self.assertRaises(TypeError): r1.update(10, 10, "20", 40) with self.assertRaises(ValueError): r1.update(id=10, x=10, y=20, width=40, height=-60) with self.assertRaises(TypeError): r1.update(id=10, x=10, y=20, width="30", height=40) with self.assertRaises(AttributeError): r2 = None r2.to_dictionary