Skip to content

Commit a35c19d

Browse files
authored
Test the arcade module (#1412)
* Test the arcade module * Remove unused List in gl.types * Take 2: Fixed unused import warning
1 parent be3230a commit a35c19d

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

arcade/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ def configure_logging(level: Optional[int] = None):
350350
'Camera',
351351
'SimpleCamera',
352352
'Color',
353-
'DEFAULT_FONT_NAMES',
354353
'EasingData',
355354
'EmitBurst',
356355
'EmitController',
@@ -521,6 +520,7 @@ def configure_logging(level: Optional[int] = None):
521520
'isometric_grid_to_screen',
522521
'lerp',
523522
'lerp_vec',
523+
'lerp_angle',
524524
'load_animated_gif',
525525
'load_font',
526526
'load_sound',

arcade/gl/types.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,21 +214,20 @@ def __init__(
214214
normalized: Optional[Iterable[str]] = None,
215215
instanced: bool = False,
216216
):
217-
218217
#: The :py:class:`~arcade.gl.Buffer` this description object describes
219218
self.buffer = buffer # type: Buffer
220219
#: List of string attributes
221220
self.attributes = attributes
222221
#: List of normalized attributes
223222
self.normalized = set() if normalized is None else set(normalized)
224223
#: Instanced flag (bool)
225-
self.instanced = instanced # type: bool
224+
self.instanced: bool = instanced
226225
#: Formats of each attribute
227-
self.formats = [] # type: List[AttribFormat]
226+
self.formats: List[AttribFormat] = []
228227
#: The byte stride of the buffer
229-
self.stride = -1 # type: int
228+
self.stride: int = -1
230229
#: Number of vertices in the buffer
231-
self.num_vertices = -1 # type: int
230+
self.num_vertices: int = -1
232231

233232
if not isinstance(buffer, Buffer):
234233
raise ValueError("buffer parameter must be an arcade.gl.Buffer")

tests/unit2/test_arcade.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
1+
from types import ModuleType
2+
from copy import copy
13
import logging
24
import arcade
5+
from arcade import *
6+
7+
8+
def test_import():
9+
"""Compare arcade.__all__ to the actual module contents"""
10+
import arcade
11+
global_names = set(k for k in globals() if not k.startswith('_'))
12+
arcade_names = set(k for k in arcade.__dict__ if not k.startswith('_'))
13+
14+
# Get the common members
15+
common = global_names.intersection(arcade_names)
16+
remaining = arcade_names - common
17+
for name in copy(remaining):
18+
attr = getattr(arcade, name)
19+
if type(attr) is ModuleType:
20+
remaining.remove(name)
21+
elif not attr.__module__.startswith('arcade.'):
22+
remaining.remove(name)
23+
24+
assert len(remaining) == 0
325

426

527
def test_logging():

0 commit comments

Comments
 (0)