Skip to content

Commit

Permalink
Merge pull request #52 from hugovk/convert-to-pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored Nov 29, 2021
2 parents 7843a64 + d3a1ee1 commit 87c3c90
Show file tree
Hide file tree
Showing 11 changed files with 234 additions and 228 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.0
rev: v2.29.1
hooks:
- id: pyupgrade
args: [--py37-plus]

- repo: https://github.com/psf/black
rev: 21.9b0
rev: 21.11b1
hooks:
- id: black
args: [--target-version=py37]
exclude: ^html/

- repo: https://github.com/PyCQA/isort
rev: 5.9.3
rev: 5.10.1
hooks:
- id: isort

Expand All @@ -39,7 +39,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.18.0
rev: v1.20.0
hooks:
- id: setup-cfg-fmt

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ python_requires = >=3.7
include_package_data = True
package_dir = =src
setup_requires =
setuptools_scm
setuptools-scm

[options.packages.find]
where = src
Expand Down
10 changes: 5 additions & 5 deletions src/osmviz/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def get_bounding_box(self):
be implemented if this SimViz is passed in as one of the
scene_viz's (as opposed to an actor_viz).
"""
raise Exception("UNIMPLEMENTED")
raise NotImplementedError

def get_time_interval(self):
"""
Expand All @@ -95,7 +95,7 @@ def get_time_interval(self):
visualization object.
May return (-Inf, Inf) to indicate that it is always present.
"""
raise Exception("UNIMPLEMENTED")
raise NotImplementedError

def set_state(self, sim_time, get_xy):
"""
Expand All @@ -104,15 +104,15 @@ def set_state(self, sim_time, get_xy):
This should be stored internally, for subsequent calls to
methods such as drawToSurface or mouseIntersect.
"""
raise Exception("UNIMPLEMENTED")
raise NotImplementedError

def draw_to_surface(self, surf):
"""
To be overridden.
Draws this viz on the supplied surface, according to its
internal state.
"""
raise Exception("UNIMPLEMENTED")
raise NotImplementedError

def get_drawing_order(self):
"""
Expand Down Expand Up @@ -140,7 +140,7 @@ def mouse_intersect(self, mouse_x, mouse_y):
Note that for Simulation purposes, if get_label() returns
None then this method does not need to be implemented.
"""
raise Exception("UNIMPLEMENTED")
raise NotImplementedError


class TrackingViz(SimViz):
Expand Down
6 changes: 3 additions & 3 deletions src/osmviz/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,21 @@ def paste_image(self, img, xy):
Given an already-loaded file, paste it into the internal image
at the specified top-left coordinate.
"""
raise Exception("UNIMPLEMENTED")
raise NotImplementedError

def load_image_file(self, image_file):
"""
To be overridden.
Loads specified image file into image object and returns it.
"""
raise Exception("UNIMPLEMENTED")
raise NotImplementedError

def create_image(self, width, height):
"""
To be overridden.
Create and return image with specified dimensions
"""
raise Exception("UNIMPLEMENTED")
raise NotImplementedError

# END OF TO BE OVERRIDDEN #

Expand Down
3 changes: 0 additions & 3 deletions test/README

This file was deleted.

4 changes: 0 additions & 4 deletions test/test.sh

This file was deleted.

20 changes: 20 additions & 0 deletions test/unit/test_image_manager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""
Unit tests for ImageManager
"""
import pytest

from osmviz.manager import ImageManager


def test_unimplemented():
# Arrange
image_manager = ImageManager()
# Dummy parameters
dp1 = None
dp2 = None

# Act / Assert
with pytest.raises(NotImplementedError):
image_manager.paste_image(dp1, dp2)
image_manager.load_image_file(dp1)
image_manager.create_image(dp1, dp2)
207 changes: 0 additions & 207 deletions test/unit/test_manager.py

This file was deleted.

Loading

0 comments on commit 87c3c90

Please sign in to comment.