Example #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)
Example #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')
Example #3
0
 def test_vertical(self):
     result = utils.connect_2d_shapes(self.shapes, 10, 'vertical')
     assert result == self.union
Example #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
Example #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')
Example #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)
Example #7
0
 def test_vertical(self):
     result = utils.connect_2d_shapes(self.shapes, 10, "vertical")
     assert result == self.union
Example #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")
Example #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")
Example #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