示例#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 == '##..:.##.:....:....'