Ejemplo n.º 1
0
 def test_horizontal(self):
     result = utils.connect_2d_shapes(self.shapes, 10, 'horizontal')
     vector = [0, 1, 0]
     assert result == ast.Rotate(90, vector, self.union)
Ejemplo n.º 2
0
def test_connect_invalid_arguments():
    """Test that arguments for ``connect_2d_shapes`` are validated."""
    shapes = [ast.Circle(5), ast.Circle(2)]
    with pytest.raises(AssertionError):
        utils.connect_2d_shapes(shapes, 10, 'diagonal')
Ejemplo n.º 3
0
 def test_vertical(self):
     result = utils.connect_2d_shapes(self.shapes, 10, 'vertical')
     assert result == self.union
Ejemplo n.º 4
0
 def test_vertical_quads(self):
     result = utils.connect_2d_shapes(self.shapes, 5, 'vertical')
     assert result.items[0].item.quads == self.union.items[0].item.quads
     assert result.items[1].item.quads == self.union.items[1].item.quads
Ejemplo n.º 5
0
def test_connect_heterogenous_handling():
    """Assert that heterogenous shapes cannot be merged."""
    shapes = [ast.Circle(5), ast.Rectangle(2, 3)]
    with pytest.raises(NotImplementedError):
        utils.connect_2d_shapes(shapes, 10, 'vertical')
Ejemplo n.º 6
0
 def test_horizontal(self):
     result = utils.connect_2d_shapes(self.shapes, 10, "horizontal")
     vector = [0, 1, 0]
     assert result == ast.Rotate(90, vector, self.union)
Ejemplo n.º 7
0
 def test_vertical(self):
     result = utils.connect_2d_shapes(self.shapes, 10, "vertical")
     assert result == self.union
Ejemplo n.º 8
0
def test_connect_invalid_arguments():
    """Test that arguments for ``connect_2d_shapes`` are validated."""
    shapes = [ast.Circle(5), ast.Circle(2)]
    with pytest.raises(AssertionError):
        utils.connect_2d_shapes(shapes, 10, "diagonal")
Ejemplo n.º 9
0
def test_connect_heterogenous_handling():
    """Assert that heterogenous shapes cannot be merged."""
    shapes = [ast.Circle(5), ast.Rectangle(2, 3)]
    with pytest.raises(NotImplementedError):
        utils.connect_2d_shapes(shapes, 10, "vertical")
Ejemplo n.º 10
0
 def test_vertical_quads(self):
     result = utils.connect_2d_shapes(self.shapes, 5, "vertical")
     assert result.items[0].item.quads == self.union.items[0].item.quads
     assert result.items[1].item.quads == self.union.items[1].item.quads