From b0b9ddc60f557d081b7b2a853f29fec4f8e32630 Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Fri, 25 Nov 2022 02:18:18 +0100 Subject: [PATCH 1/3] Test the arcade module --- arcade/__init__.py | 2 +- tests/unit2/test_arcade.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/arcade/__init__.py b/arcade/__init__.py index 49889c148..1634a6cfd 100644 --- a/arcade/__init__.py +++ b/arcade/__init__.py @@ -350,7 +350,6 @@ def configure_logging(level: Optional[int] = None): 'Camera', 'SimpleCamera', 'Color', - 'DEFAULT_FONT_NAMES', 'EasingData', 'EmitBurst', 'EmitController', @@ -521,6 +520,7 @@ def configure_logging(level: Optional[int] = None): 'isometric_grid_to_screen', 'lerp', 'lerp_vec', + 'lerp_angle', 'load_animated_gif', 'load_font', 'load_sound', diff --git a/tests/unit2/test_arcade.py b/tests/unit2/test_arcade.py index df3f0c07e..e64c08291 100644 --- a/tests/unit2/test_arcade.py +++ b/tests/unit2/test_arcade.py @@ -1,5 +1,27 @@ +from types import ModuleType +from copy import copy import logging import arcade +from arcade import * + + +def test_import(): + """Compare arcade.__all__ to the actual module contents""" + import arcade + global_names = set(k for k in globals() if not k.startswith('_')) + arcade_names = set(k for k in arcade.__dict__ if not k.startswith('_')) + + # Get the common members + common = global_names.intersection(arcade_names) + remaining = arcade_names - common + for name in copy(remaining): + attr = getattr(arcade, name) + if type(attr) is ModuleType: + remaining.remove(name) + elif not attr.__module__.startswith('arcade.'): + remaining.remove(name) + + assert len(remaining) == 0 def test_logging(): From b2715fa393c64e804f046d26e15c12ba4c361cea Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Fri, 25 Nov 2022 02:32:01 +0100 Subject: [PATCH 2/3] Remove unused List in gl.types --- arcade/gl/types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arcade/gl/types.py b/arcade/gl/types.py index 348056822..4d866f776 100644 --- a/arcade/gl/types.py +++ b/arcade/gl/types.py @@ -1,5 +1,5 @@ import re -from typing import Optional, Iterable, List, Union +from typing import Optional, Iterable, Union from pyglet import gl From 1b2a94f2e603c71eb1d960f59dde0d75b022af01 Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Fri, 25 Nov 2022 02:35:56 +0100 Subject: [PATCH 3/3] Take 2: Fixed unused import warning --- arcade/gl/types.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/arcade/gl/types.py b/arcade/gl/types.py index 4d866f776..adaf05e27 100644 --- a/arcade/gl/types.py +++ b/arcade/gl/types.py @@ -1,5 +1,5 @@ import re -from typing import Optional, Iterable, Union +from typing import Optional, Iterable, List, Union from pyglet import gl @@ -214,7 +214,6 @@ def __init__( normalized: Optional[Iterable[str]] = None, instanced: bool = False, ): - #: The :py:class:`~arcade.gl.Buffer` this description object describes self.buffer = buffer # type: Buffer #: List of string attributes @@ -222,13 +221,13 @@ def __init__( #: List of normalized attributes self.normalized = set() if normalized is None else set(normalized) #: Instanced flag (bool) - self.instanced = instanced # type: bool + self.instanced: bool = instanced #: Formats of each attribute - self.formats = [] # type: List[AttribFormat] + self.formats: List[AttribFormat] = [] #: The byte stride of the buffer - self.stride = -1 # type: int + self.stride: int = -1 #: Number of vertices in the buffer - self.num_vertices = -1 # type: int + self.num_vertices: int = -1 if not isinstance(buffer, Buffer): raise ValueError("buffer parameter must be an arcade.gl.Buffer")