-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding len and delitem to Scene (#1721)
- Loading branch information
1 parent
f4a959f
commit cf13697
Showing
2 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import arcade | ||
import pytest | ||
|
||
|
||
def test_len(): | ||
scene = arcade.Scene() | ||
scene.add_sprite_list("Player") | ||
|
||
assert len(scene) == 1 | ||
|
||
scene.add_sprite_list("Walls") | ||
scene.add_sprite_list("Coins") | ||
|
||
assert len(scene) == 3 | ||
|
||
def test_delitem(): | ||
scene = arcade.Scene() | ||
scene.add_sprite_list("Walls") | ||
scene.add_sprite_list("Player") | ||
del scene["Player"] | ||
|
||
with pytest.raises(KeyError): | ||
scene["Player"] | ||
|
||
del scene[scene._sprite_lists[0]] | ||
|
||
with pytest.raises(KeyError): | ||
scene["Walls"] |