Format code with black
This commit is contained in:
@@ -100,7 +100,7 @@ traps:
|
||||
mode: pingpong
|
||||
speed: 160
|
||||
""")
|
||||
place(g, 4, 3) # on the floor, at the block's body level
|
||||
place(g, 4, 3) # on the floor, at the block's body level
|
||||
floor_top = 4 * 32
|
||||
start_x = g.player.rect.x
|
||||
max_bottom = g.player.rect.bottom
|
||||
@@ -109,8 +109,8 @@ traps:
|
||||
max_bottom = max(max_bottom, g.player.rect.bottom)
|
||||
if g.state != "playing":
|
||||
break
|
||||
assert max_bottom <= floor_top + 1 # never pushed into the floor
|
||||
assert g.player.rect.x < start_x # got shoved along
|
||||
assert max_bottom <= floor_top + 1 # never pushed into the floor
|
||||
assert g.player.rect.x < start_x # got shoved along
|
||||
|
||||
|
||||
def test_ride_into_wall_stops_no_crush(make_game):
|
||||
@@ -137,7 +137,7 @@ traps:
|
||||
""")
|
||||
# stand the player on top of the platform at its left end (body in row 2)
|
||||
place(g, 1, 2)
|
||||
g.player.fy = float(3 * 32 - g.player.h) # feet on the block's top
|
||||
g.player.fy = float(3 * 32 - g.player.h) # feet on the block's top
|
||||
g.player._sync_rect()
|
||||
wall_left = 8 * 32
|
||||
hit_wall = False
|
||||
@@ -145,12 +145,12 @@ traps:
|
||||
step(g)
|
||||
if g.state != "playing":
|
||||
break
|
||||
assert not g.player.crushed # never crushed
|
||||
assert g.player.rect.right <= wall_left + 1 # stopped at the wall
|
||||
assert not g.player.crushed # never crushed
|
||||
assert g.player.rect.right <= wall_left + 1 # stopped at the wall
|
||||
if g.player.rect.right >= wall_left - 1:
|
||||
hit_wall = True
|
||||
assert g.state == "playing" # survived the whole time
|
||||
assert hit_wall # actually reached the wall
|
||||
assert g.state == "playing" # survived the whole time
|
||||
assert hit_wall # actually reached the wall
|
||||
|
||||
|
||||
def test_corner_clip_does_not_warp(make_game):
|
||||
@@ -177,7 +177,7 @@ traps:
|
||||
prev = g.player.rect.x
|
||||
for _ in range(120):
|
||||
step(g, hold(left=True))
|
||||
assert g.player.rect.x - prev <= 28 # no sudden rightward warp
|
||||
assert g.player.rect.x - prev <= 28 # no sudden rightward warp
|
||||
prev = g.player.rect.x
|
||||
|
||||
|
||||
@@ -213,4 +213,4 @@ traps:
|
||||
if not g.player.on_ground and g.player.rect.bottom > 3 * 32:
|
||||
left_at = reversalsN
|
||||
break
|
||||
assert left_at == 0 # fell before any block reversal
|
||||
assert left_at == 0 # fell before any block reversal
|
||||
|
||||
Reference in New Issue
Block a user