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