Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 32518d1

Browse filesBrowse files
committed
run all domain tests over random domains, rather than hypercubes
1 parent 6bdbe88 commit 32518d1
Copy full SHA for 32518d1

File tree

Expand file treeCollapse file tree

1 file changed

+18
-18
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+18
-18
lines changed

‎adaptive/tests/test_domain.py

Copy file name to clipboardExpand all lines: adaptive/tests/test_domain.py
+18-18Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pytest
55
from adaptive.tests.domain_utils import (
66
a_few_points_inside,
7-
make_hypercube_domain,
7+
make_random_domain,
88
point_inside,
99
point_on_shared_face,
1010
point_outside,
@@ -18,7 +18,7 @@
1818
@given(data=st.data())
1919
@settings(deadline=500)
2020
def test_getting_points_are_unique(data, ndim):
21-
domain = data.draw(make_hypercube_domain(ndim))
21+
domain = data.draw(make_random_domain(ndim))
2222
points = []
2323
for subdomain in domain.subdomains():
2424
p, _ = domain.insert_points(subdomain, 10)
@@ -30,7 +30,7 @@ def test_getting_points_are_unique(data, ndim):
3030
@pytest.mark.parametrize("ndim", [1, 2, 3])
3131
@given(data=st.data())
3232
def test_sum_subvolumes_equals_volume(data, ndim):
33-
domain = data.draw(make_hypercube_domain(ndim))
33+
domain = data.draw(make_random_domain(ndim))
3434
xs = data.draw(a_few_points_inside(domain))
3535

3636
for x in xs:
@@ -42,7 +42,7 @@ def test_sum_subvolumes_equals_volume(data, ndim):
4242
@pytest.mark.parametrize("ndim", [1, 2, 3])
4343
@given(data=st.data())
4444
def test_split_at_vertex_raises(data, ndim):
45-
domain = data.draw(make_hypercube_domain(ndim))
45+
domain = data.draw(make_random_domain(ndim))
4646
x = data.draw(point_inside(domain))
4747
domain.split_at(x)
4848
with pytest.raises(ValueError):
@@ -52,7 +52,7 @@ def test_split_at_vertex_raises(data, ndim):
5252
@pytest.mark.parametrize("ndim", [1, 2, 3])
5353
@given(data=st.data())
5454
def test_inserting_point_twice_raises(data, ndim):
55-
domain = data.draw(make_hypercube_domain(ndim))
55+
domain = data.draw(make_random_domain(ndim))
5656
x = data.draw(point_inside(domain))
5757
domain.insert(x)
5858
with pytest.raises(ValueError):
@@ -62,7 +62,7 @@ def test_inserting_point_twice_raises(data, ndim):
6262
@pytest.mark.parametrize("ndim", [1, 2, 3])
6363
@given(data=st.data())
6464
def test_insert_points_outside_domain_raises(data, ndim):
65-
domain = data.draw(make_hypercube_domain(ndim))
65+
domain = data.draw(make_random_domain(ndim))
6666
x = data.draw(point_outside(domain))
6767
with pytest.raises(ValueError):
6868
domain.insert(x)
@@ -71,7 +71,7 @@ def test_insert_points_outside_domain_raises(data, ndim):
7171
@pytest.mark.parametrize("ndim", [1, 2, 3])
7272
@given(data=st.data())
7373
def test_encloses(data, ndim):
74-
domain = data.draw(make_hypercube_domain(ndim))
74+
domain = data.draw(make_random_domain(ndim))
7575

7676
xin = data.draw(point_inside(domain))
7777
assert domain.encloses(xin)
@@ -89,7 +89,7 @@ def test_encloses(data, ndim):
8989
@pytest.mark.parametrize("ndim", [1, 2, 3])
9090
@given(data=st.data())
9191
def test_insert_point_outside_domain_raises(data, ndim):
92-
domain = data.draw(make_hypercube_domain(ndim))
92+
domain = data.draw(make_random_domain(ndim))
9393
x = data.draw(point_outside(domain))
9494
with pytest.raises(ValueError):
9595
domain.insert(x)
@@ -98,7 +98,7 @@ def test_insert_point_outside_domain_raises(data, ndim):
9898
@pytest.mark.parametrize("ndim", [1, 2, 3])
9999
@given(data=st.data())
100100
def test_split_at_point_outside_domain_raises(data, ndim):
101-
domain = data.draw(make_hypercube_domain(ndim))
101+
domain = data.draw(make_random_domain(ndim))
102102
x = data.draw(point_outside(domain))
103103
with pytest.raises(ValueError):
104104
domain.split_at(x)
@@ -107,7 +107,7 @@ def test_split_at_point_outside_domain_raises(data, ndim):
107107
@pytest.mark.parametrize("ndim", [1, 2, 3])
108108
@given(data=st.data())
109109
def test_removing_domain_vertex_raises(data, ndim):
110-
domain = data.draw(make_hypercube_domain(ndim))
110+
domain = data.draw(make_random_domain(ndim))
111111
x = data.draw(point_inside(domain))
112112
domain.split_at(x)
113113
with pytest.raises(ValueError):
@@ -117,7 +117,7 @@ def test_removing_domain_vertex_raises(data, ndim):
117117
@pytest.mark.parametrize("ndim", [1, 2, 3])
118118
@given(data=st.data())
119119
def test_removing_nonexistant_point_raises(data, ndim):
120-
domain = data.draw(make_hypercube_domain(ndim))
120+
domain = data.draw(make_random_domain(ndim))
121121
x = data.draw(point_inside(domain))
122122
with pytest.raises(ValueError):
123123
domain.remove(x)
@@ -126,7 +126,7 @@ def test_removing_nonexistant_point_raises(data, ndim):
126126
@pytest.mark.parametrize("ndim", [1, 2, 3])
127127
@given(data=st.data())
128128
def test_splitting_at_point_adds_to_vertices(data, ndim):
129-
domain = data.draw(make_hypercube_domain(ndim))
129+
domain = data.draw(make_random_domain(ndim))
130130
xs = data.draw(a_few_points_inside(domain))
131131

132132
for x in xs:
@@ -138,7 +138,7 @@ def test_splitting_at_point_adds_to_vertices(data, ndim):
138138
@pytest.mark.parametrize("ndim", [1, 2, 3])
139139
@given(data=st.data())
140140
def test_inserting_points_adds_to_subpoints(data, ndim):
141-
domain = data.draw(make_hypercube_domain(ndim))
141+
domain = data.draw(make_random_domain(ndim))
142142
xs = data.draw(a_few_points_inside(domain))
143143

144144
subdomains = dict()
@@ -152,7 +152,7 @@ def test_inserting_points_adds_to_subpoints(data, ndim):
152152
@pytest.mark.parametrize("ndim", [1, 2, 3])
153153
@given(data=st.data())
154154
def test_inserting_then_removing_points_removes_from_subpoints(data, ndim):
155-
domain = data.draw(make_hypercube_domain(ndim))
155+
domain = data.draw(make_random_domain(ndim))
156156
xs = data.draw(a_few_points_inside(domain))
157157

158158
for x in xs:
@@ -166,7 +166,7 @@ def test_inserting_then_removing_points_removes_from_subpoints(data, ndim):
166166
@given(data=st.data())
167167
@settings(deadline=500)
168168
def test_inserting_then_splitting_at_points_removes_from_subpoints(data, ndim):
169-
domain = data.draw(make_hypercube_domain(ndim))
169+
domain = data.draw(make_random_domain(ndim))
170170
xs = data.draw(a_few_points_inside(domain))
171171

172172
for x in xs:
@@ -179,7 +179,7 @@ def test_inserting_then_splitting_at_points_removes_from_subpoints(data, ndim):
179179
@pytest.mark.parametrize("ndim", [1, 2, 3])
180180
@given(data=st.data())
181181
def test_clear_subdomains_removes_all_points(data, ndim):
182-
domain = data.draw(make_hypercube_domain(ndim))
182+
domain = data.draw(make_random_domain(ndim))
183183
xs = data.draw(a_few_points_inside(domain))
184184

185185
for x in xs:
@@ -192,7 +192,7 @@ def test_clear_subdomains_removes_all_points(data, ndim):
192192
@pytest.mark.parametrize("ndim", [1, 2, 3])
193193
@given(data=st.data())
194194
def test_split_at_reassigns_all_internal_points(data, ndim):
195-
domain = data.draw(make_hypercube_domain(ndim))
195+
domain = data.draw(make_random_domain(ndim))
196196
x_split, *xs = data.draw(a_few_points_inside(domain))
197197

198198
for x in xs:
@@ -216,7 +216,7 @@ def test_split_at_reassigns_all_internal_points(data, ndim):
216216
@pytest.mark.parametrize("ndim", [2, 3])
217217
@given(data=st.data())
218218
def test_inserting_point_on_boundary_adds_to_all_subtriangulations(data, ndim):
219-
domain = data.draw(make_hypercube_domain(ndim))
219+
domain = data.draw(make_random_domain(ndim))
220220
xs = data.draw(a_few_points_inside(domain))
221221

222222
for x in xs:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.