-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 'master'
Release 1.19.1 See merge request Scientific-IT-Systems/python-gr!208
- Loading branch information
Showing
5 changed files
with
149 additions
and
140 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 was deleted.
Oops, something went wrong.
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,117 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# standard library | ||
|
||
# third party | ||
|
||
# local library | ||
import gr | ||
from gr.pygr import Coords2DList, Coords2D, Coords3DList, Coords3D | ||
|
||
|
||
def test_char(): | ||
gr.char("t") | ||
gr.char(u"t") | ||
|
||
|
||
def test_coords2DList_minmax(): | ||
a = Coords2D([10, 20, 30], [10, 20, 30]) | ||
coords = Coords2DList([a]) | ||
assert coords.xmin == 10 | ||
assert coords.xmax == 30 | ||
assert coords.ymin == 10 | ||
assert coords.ymax == 30 | ||
|
||
coords.append(Coords2D([5, 10], [20, 40])) | ||
assert coords.xmin == 5 | ||
assert coords.xmax == 30 | ||
assert coords.ymin == 10 | ||
assert coords.ymax == 40 | ||
|
||
b = Coords2D([1, 2, 3], [1, 2, 3]) | ||
coords += [b] | ||
assert coords.xmin == 1 | ||
assert coords.xmax == 30 | ||
assert coords.ymin == 1 | ||
assert coords.ymax == 40 | ||
|
||
tmp = coords.pop(coords.index(b)) | ||
assert tmp == b | ||
assert coords.xmin == 5 | ||
assert coords.xmax == 30 | ||
assert coords.ymin == 10 | ||
assert coords.ymax == 40 | ||
|
||
coords.extend([b]) | ||
assert coords.xmin == 1 | ||
assert coords.xmax == 30 | ||
assert coords.ymin == 1 | ||
assert coords.ymax == 40 | ||
|
||
coords.remove(b) | ||
assert coords.xmin == 5 | ||
assert coords.xmax == 30 | ||
assert coords.ymin == 10 | ||
assert coords.ymax == 40 | ||
|
||
coords.append(Coords2D([10, 10], [0, 0])) | ||
assert coords.xmin == 5 | ||
assert coords.xmax == 30 | ||
assert coords.ymin == 0 | ||
assert coords.ymax == 40 | ||
|
||
coords.append(Coords2D([10, 10], [200, 400])) | ||
assert coords.xmin == 5 | ||
assert coords.xmax == 30 | ||
assert coords.ymin == 0 | ||
assert coords.ymax == 400 | ||
|
||
|
||
def test_coords2DList_empty(): | ||
a = Coords2D([10, 20, 30], [10, 20, 30]) | ||
coords = Coords2DList([a]) | ||
coords.remove(a) | ||
assert coords.xmin is None | ||
assert coords.xmax is None | ||
assert coords.ymin is None | ||
assert coords.ymax is None | ||
|
||
|
||
def test_coords2DList_update(): | ||
a = Coords2D([10, 20, 30], [10, 20, 30]) | ||
b = Coords2D([5], [40]) | ||
coords = Coords2DList([a, b]) | ||
assert coords.xmin == 5 | ||
assert coords.xmax == 30 | ||
assert coords.ymin == 10 | ||
assert coords.ymax == 40 | ||
|
||
b.x = [15] | ||
b.y = [25] | ||
coords.updateMinMax(b) | ||
assert coords.xmin == 5 | ||
assert coords.xmax == 30 | ||
assert coords.ymin == 10 | ||
assert coords.ymax == 40 | ||
|
||
coords.updateMinMax(*coords, reset=True) | ||
assert coords.xmin == 10 | ||
assert coords.xmax == 30 | ||
assert coords.ymin == 10 | ||
assert coords.ymax == 30 | ||
|
||
coords.updateMinMax(b, reset=True) | ||
assert coords.xmin == 15 | ||
assert coords.xmax == 15 | ||
assert coords.ymin == 25 | ||
assert coords.ymax == 25 | ||
|
||
|
||
def test_coords3DList_minmax(): | ||
coords = Coords3DList([Coords3D([1, 2], [1, 2], [-42, 42])]) | ||
assert coords.xmin == 1 | ||
assert coords.xmax == 2 | ||
assert coords.ymin == 1 | ||
assert coords.ymax == 2 | ||
assert coords.zmin == -42 | ||
assert coords.zmax == 42 |
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
[tox] | ||
envlist = py27,py36,py37,py38,py39 | ||
envlist = py27,py37,py38,py39,py310 | ||
skipsdist = True | ||
[testenv] | ||
passenv = GR_TEST_BASE_PATH | ||
deps = | ||
nose | ||
pytest | ||
/gr-test/ | ||
commands = python -c "import subprocess, glob; subprocess.check_call(['pip', 'install', glob.glob('dist/gr-*.tar.gz')[0]])" | ||
nosetests tests/gr | ||
pytest tests |