def test_create_center_wrong_type(self): """Test Value of Arg 0 is expected to be type Vector but got str.""" with self.assertRaisesRegexp( SdlSyntaxException, 'Value of Argument 0 is expected to be type Vector but got str' ): self.sut = Sphere('foo', 8, ObjectModifier('foo'), open=0.3)
def test_create_v2_wrong_length(self): """Test parameter v1 wrong length.""" with self.assertRaisesRegexp( SdlSyntaxException, 'Vector v2 has more or less than 3 dimensions'): self.sut = Box(Vector(1, 2, 3), Vector(4, 5, 6, 7), ObjectModifier('foo'))
def test_create_non_existant_kw(self): """Test No such Keyword: bar.""" with self.assertRaisesRegexp(SdlSyntaxException, 'No such Keyword: bar'): self.sut = Sphere(Vector(5, 6, 7), 8, ObjectModifier('foo'), bar=True)
def test_create_center_wrong_length(self): """Test Center point Vector has more or less than 3 dimensions.""" with self.assertRaisesRegexp( SdlSyntaxException, 'Center point Vector has more or less than 3 dimensions'): self.sut = Sphere(Vector(1, 2, 3, 9), 8, ObjectModifier('foo'), open=0.3)
def test_create_non_existant_kw(self): """Test creation wrong kwarg.""" with self.assertRaisesRegexp(SdlSyntaxException, 'Invalid keyword: bar'): self.sut = Cylinder(Vector(1, 2, 3), Vector(5, 6, 7), 8, ObjectModifier('foo'), bar=True)
def test_create_open_wrong_type(self): """Test creation with kwarg wrong type.""" with self.assertRaisesRegexp(SdlSyntaxException, 'Value of keyword open is not boolean'): self.sut = Cylinder(Vector(1, 2, 3), Vector(5, 6, 7), 8, ObjectModifier('foo'), open='foo')
def test_creation_w_opt_and_kwarg(self): """Test creation and inheritance with option and kwarg.""" self.sut = Cylinder(Vector(1, 2, 3), Vector(5, 6, 7), 8, ObjectModifier('foo'), open=True) self.assertIsInstance(self.sut, Cylinder) self.assertIsInstance(self.sut, SceneItem)
def test_create_radius_wrong_type(self): """Test Value of Argument 1 is expected to be type.""" with self.assertRaisesRegexp( SdlSyntaxException, ' '.join( ('Value of Argument 1 is expected to be type', '\\(\'float\', \'int\'\\) but got str'))): self.sut = Sphere(Vector(1, 2, 3), 'foo', ObjectModifier('foo'), open=0.3)
def test_create_radius_wrong_type(self): """Test Param radius is not of type int or float.""" with self.assertRaisesRegexp( SdlSyntaxException, 'Param radius is not of type int or float'): self.sut = Cylinder(Vector(1, 2, 3), Vector(5, 6, 7), 'foo', ObjectModifier('foo'), open=0.3)
def test_create_cpoint_wrong_length(self): """Test Cap point Vector has more or less than 3 dimensions.""" with self.assertRaisesRegexp( SdlSyntaxException, 'Cap point Vector has more or less than 3 dimensions'): self.sut = Cylinder(Vector(1, 2, 3), Vector(5, 6, 7, 9), 8, ObjectModifier('foo'), open=0.3)
def test_create_cappoint_wrong_type(self): """Test Parameter cappoint is not of type Vector.""" with self.assertRaisesRegexp( SdlSyntaxException, 'Parameter cappoint is not of type Vector'): self.sut = Cylinder(Vector(1, 2, 3), 'foo', 8, ObjectModifier('foo'), open=0.3)
def test_create_crad_wrong_type(self): """Test creation wrong type capradius.""" with self.assertRaisesRegexp( SdlSyntaxException, 'Param cap radius is not of type int or float'): self.sut = Cone(Vector(1, 2, 3), 4, Vector(5, 6, 7), 'foo', ObjectModifier('foo'), open=0.3)
def test_create_bpoint_wrong_type(self): """Test creation wrong type basepoint.""" with self.assertRaisesRegexp( SdlSyntaxException, 'Parameter basepoint is not of type Vector'): self.sut = Cone('foo', 4, Vector(5, 6, 7), 8, ObjectModifier('foo'), open=0.3)
def test_create_bpoint_wrong_length(self): """Test creation wrong length basepoint.""" with self.assertRaisesRegexp( SdlSyntaxException, 'Base point Vector has more or less than 3 dimensions'): self.sut = Cone(Vector(1, 2, 3, 9), 4, Vector(5, 6, 7), 8, ObjectModifier('foo'), open=0.3)
def test_create_with_option(self): """Test creation and inheritance with option.""" sut = Box(Vector(1, 2, 3), Vector(4, 5, 6), ObjectModifier('foo')) self.assertIsInstance(sut, Box) self.assertIsInstance(sut, SceneItem)
def test_creation_with_option(self): """Test creation with option.""" self.sut = Sphere(Vector(1, 2, 3), 8, ObjectModifier('foo')) self.assertIsInstance(self.sut, Sphere) self.assertIsInstance(self.sut, SceneItem)
def test_create_v2_wrong_type(self): """Test creation with wrong param v2.""" with self.assertRaisesRegexp(SdlSyntaxException, 'Parameter v2 not of type Vector'): self.sut = Box(Vector(5, 6, 7), 'foo', ObjectModifier('foo'))