예제 #1
0
 def test_stack_tall(self):
     bottom = Shape('#...:#...:....:....')
     top = Shape('#...:#...:....:....')
     merged = bottom.stack(top)
     assert merged == '#...:#...:#...:#...'
예제 #2
0
 def test_diagonal(self):
     bottom = Shape('...#:....:....:....')
     top = Shape('.#..:....:....:....')
     merged = bottom.stack(top)
     assert merged == '.#.#:....:....:....'
예제 #3
0
 def test_stack_full_layers(self):
     bottom = Shape('####:....:....:....')
     top = Shape('####:....:....:....')
     merged = bottom.stack(top)
     assert merged == '####:####:....:....'
예제 #4
0
 def test_no_empty_shape(self):
     empty = Shape('....:....:....:....')
     with pytest.raises(ValueError):
         empty.stack(empty)
예제 #5
0
 def test_simple_merge(self):
     bottom = Shape('##..:....:....:....')
     top = Shape('..##:....:....:....')
     merged = bottom.stack(top)
     assert merged == '####:....:....:....'
예제 #6
0
 def test_tetris(self):
     bottom = Shape('.##.:..#.:..#.:....')
     top = Shape('.#..:.##.:....:....')
     merged = bottom.stack(top)
     assert merged == '.##.:..#.:.##.:.##.'
예제 #7
0
 def test_logo(self):
     left_half = Shape('...#:..#.:....:....')
     right_half = Shape('##..:....:....:....')
     logo = left_half.stack(right_half)
     assert logo == '##.#:..#.:....:....'
예제 #8
0
 def test_trim_to_four_layers(self):
     bottom = Shape('#...:#...:...#:....')
     top = Shape('####:...#:....:....')
     merged = bottom.stack(top)
     assert merged == '#...:#...:...#:####'
예제 #9
0
 def test_long_drop(self):
     bottom = Shape('#...:#...:#...:#...')
     top = Shape('.#..:....:....:....')
     merged = bottom.stack(top)
     assert merged == '##..:#...:#...:#...'
예제 #10
0
 def test_staircase(self):
     bottom = Shape('#..#:##..:....:....')
     top = Shape('.##.:..##:....:....')
     merged = bottom.stack(top)
     assert merged == '#..#:##..:.##.:..##'
예제 #11
0
 def test_stack_merge_on_second_layer(self):
     bottom = Shape('##..:#...:....:....')
     top = Shape('.##.:....:....:....')
     merged = bottom.stack(top)
     assert merged == '##..:###.:....:....'
예제 #12
0
 def test_stack_angle(self):
     bottom = Shape('##..:....:....:....')
     top = Shape('.##.:....:....:....')
     merged = bottom.stack(top)
     assert merged == '##..:.##.:....:....'