-
Notifications
You must be signed in to change notification settings - Fork 6
/
test_brachiograph.py
executable file
·64 lines (42 loc) · 1.28 KB
/
test_brachiograph.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import pytest
from brachiograph import BrachioGraph
import linedraw
virtual_bg = BrachioGraph(
inner_arm=8,
outer_arm=8,
bounds=(-6, 4, 6, 12),
virtual_mode=True
)
# ----------------- drawing methods -----------------
def test_plot_from_file():
virtual_bg.plot_file("test-patterns/test-pattern.json")
# ----------------- test pattern methods -----------------
def test_test_pattern():
virtual_bg.test_pattern()
def test_vertical_lines():
virtual_bg.vertical_lines()
def test_horizontal_lines():
virtual_bg.horizontal_lines()
def test_box():
virtual_bg.box()
# ----------------- pen-moving methods -----------------
def test_centre():
virtual_bg.park()
# ----------------- reporting methods -----------------
def test_report():
virtual_bg.report()
def test_maths_errors():
plotter = BrachioGraph(
inner_arm=8.2,
outer_arm=8.85,
)
with pytest.raises(Exception):
plotter.xy_to_angles(-10.2, 13.85)
# ----------------- end-to-end tests -----------------
def test_linedraw_to_plot():
linedraw.image_to_json(
"../test-patterns/test_pattern", resolution=1024,
draw_contours=10, repeat_contours=1,
draw_hatch=32, repeat_hatch=1,
)
virtual_bg.plot_file("images/test_gradient.json")