Skip to content

Commit

Permalink
Merge pull request #212 from ecmwf/feature/fix_tests
Browse files Browse the repository at this point in the history
fix tests
  • Loading branch information
mathleur authored Sep 18, 2024
2 parents eea882c + 9ae97ed commit 4e2d75a
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 77 deletions.
40 changes: 20 additions & 20 deletions tests/test_cyclic_axis_over_negative_vals.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def test_cyclic_float_axis_across_seam(self):
result.pprint()
assert len(result.leaves) == 1
assert [(val,) for val in result.leaves[0].values] == [
(-0.2,),
(-1.1,),
(-1.0,),
(-0.9,),
Expand All @@ -50,6 +49,7 @@ def test_cyclic_float_axis_across_seam(self):
(-0.5,),
(-0.4,),
(-0.3,),
(-0.2,),
]

def test_cyclic_float_axis_inside_cyclic_range(self):
Expand Down Expand Up @@ -93,31 +93,31 @@ def test_cyclic_float_axis_two_range_loops(self):
result.pprint()
assert len(result.leaves) == 1
assert [(val,) for val in result.leaves[0].values] == [
(-0.7,),
(-0.6,),
(-0.5,),
(-0.4,),
(-0.3,),
(-0.2,),
(-1.1,),
(-1.0,),
(-0.9,),
(-0.8,),
(-0.7,),
(-0.6,),
(-0.5,),
(-0.4,),
(-0.3,),
(-0.2,),
(-1.1,),
(-1.0,),
(-1.0,),
(-0.9,),
(-0.9,),
(-0.8,),
(-0.8,),
(-0.7,),
(-0.7,),
(-0.7,),
(-0.6,),
(-0.6,),
(-0.6,),
(-0.5,),
(-0.5,),
(-0.5,),
(-0.4,),
(-0.4,),
(-0.4,),
(-0.3,),
(-0.3,),
(-0.3,),
(-0.2,),
(-0.2,),
]

def test_cyclic_float_axis_below_axis_range(self):
Expand All @@ -142,15 +142,15 @@ def test_cyclic_float_axis_below_axis_range_crossing_seam(self):
# result.pprint()
assert len(result.leaves) == 1
assert [(val,) for val in result.leaves[0].values] == [
(-1.0,),
(-0.9,),
(-0.8,),
(-0.7,),
(-0.7,),
(-0.6,),
(-0.5,),
(-0.4,),
(-0.3,),
(-0.2,),
(-0.1,),
(-1.0,),
(-0.9,),
(-0.8,),
(-0.7,),
]
40 changes: 20 additions & 20 deletions tests/test_cyclic_axis_slicer_not_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def test_cyclic_float_axis_across_seam(self):
result.pprint()
assert len(result.leaves) == 1
assert [(val,) for val in result.leaves[0].values] == [
(-0.2,),
(-1.1,),
(-1.0,),
(-0.9,),
Expand All @@ -54,6 +53,7 @@ def test_cyclic_float_axis_across_seam(self):
(-0.5,),
(-0.4,),
(-0.3,),
(-0.2,),
]

def test_cyclic_float_axis_inside_cyclic_range(self):
Expand Down Expand Up @@ -94,31 +94,31 @@ def test_cyclic_float_axis_two_range_loops(self):
result = self.API.retrieve(request)
assert len(result.leaves) == 1
assert [(val,) for val in result.leaves[0].values] == [
(-0.7,),
(-0.6,),
(-0.5,),
(-0.4,),
(-0.3,),
(-0.2,),
(-1.1,),
(-1.0,),
(-0.9,),
(-0.8,),
(-0.7,),
(-0.6,),
(-0.5,),
(-0.4,),
(-0.3,),
(-0.2,),
(-1.1,),
(-1.0,),
(-1.0,),
(-0.9,),
(-0.9,),
(-0.8,),
(-0.8,),
(-0.7,),
(-0.7,),
(-0.7,),
(-0.6,),
(-0.6,),
(-0.6,),
(-0.5,),
(-0.5,),
(-0.5,),
(-0.4,),
(-0.4,),
(-0.4,),
(-0.3,),
(-0.3,),
(-0.3,),
(-0.2,),
(-0.2,),
]

def test_cyclic_float_axis_below_axis_range(self):
Expand All @@ -142,15 +142,15 @@ def test_cyclic_float_axis_below_axis_range_crossing_seam(self):
result = self.API.retrieve(request)
assert len(result.leaves) == 1
assert [(val,) for val in result.leaves[0].values] == [
(-1.0,),
(-0.9,),
(-0.8,),
(-0.7,),
(-0.7,),
(-0.6,),
(-0.5,),
(-0.4,),
(-0.3,),
(-0.2,),
(-0.1,),
(-1.0,),
(-0.9,),
(-0.8,),
(-0.7,),
]
66 changes: 33 additions & 33 deletions tests/test_cyclic_axis_slicing.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ def test_cyclic_float_axis_across_seam(self):
assert len(result.leaves) == 1
result.pprint()
assert [(val,) for val in result.leaves[0].values] == [
(0.8,),
(0.9,),
(1.0,),
(0.1,),
(0.2,),
(0.3,),
(0.4,),
(0.5,),
(0.6,),
(0.7,),
(0.8,),
(0.9,),
(1.0,),
]

def test_cyclic_float_axis_across_seam_repeated(self):
Expand Down Expand Up @@ -85,27 +85,27 @@ def test_cyclic_float_axis_across_seam_repeated_twice(self):
result.pprint()
assert len(result.leaves) == 1
assert [(val,) for val in result.leaves[0].values] == [
(0.0,),
(0.0,),
(0.1,),
(0.2,),
(0.3,),
(0.4,),
(0.5,),
(0.6,),
(0.7,),
(0.8,),
(0.9,),
(1.0,),
(0.1,),
(0.2,),
(0.2,),
(0.3,),
(0.3,),
(0.4,),
(0.4,),
(0.5,),
(0.5,),
(0.6,),
(0.6,),
(0.7,),
(0.7,),
(0.8,),
(0.8,),
(0.9,),
(0.0,),
(0.9,),
(1.0,),
]

def test_cyclic_float_axis_inside_cyclic_range(self):
Expand Down Expand Up @@ -151,31 +151,31 @@ def test_cyclic_float_axis_two_range_loops(self):
# result.pprint()
assert len(result.leaves) == 1
assert [(val,) for val in result.leaves[0].values] == [
(0.3,),
(0.4,),
(0.5,),
(0.6,),
(0.7,),
(0.8,),
(0.9,),
(1.0,),
(0.0,),
(0.1,),
(0.1,),
(0.2,),
(0.2,),
(0.3,),
(0.3,),
(0.3,),
(0.4,),
(0.4,),
(0.4,),
(0.5,),
(0.5,),
(0.5,),
(0.6,),
(0.6,),
(0.6,),
(0.7,),
(0.7,),
(0.7,),
(0.8,),
(0.8,),
(0.9,),
(0.0,),
(0.1,),
(0.2,),
(0.3,),
(0.4,),
(0.5,),
(0.6,),
(0.7,),
(0.9,),
(1.0,),
]

def test_cyclic_float_axis_below_axis_range(self):
Expand All @@ -201,17 +201,17 @@ def test_cyclic_float_axis_below_axis_range_crossing_seam(self):
# result.pprint()
assert len(result.leaves) == 1
assert [(val,) for val in result.leaves[0].values] == [
(0.0,),
(0.1,),
(0.2,),
(0.3,),
(0.3,),
(0.4,),
(0.5,),
(0.6,),
(0.7,),
(0.8,),
(0.9,),
(0.0,),
(0.1,),
(0.2,),
(0.3,),
]

def test_cyclic_float_axis_reversed(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cyclic_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_cyclic_float_axis_across_seam(self):
result = self.API.retrieve(request)
result.pprint()
assert len(result.leaves) == 1
assert [leaf.values for leaf in result.leaves] == [(0.9, 1.0, 0.1, 0.2)]
assert [leaf.values for leaf in result.leaves] == [(0.1, 0.2, 0.9, 1.0)]

def test_cyclic_float_surrounding(self):
request = Request(
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cyclic_snapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_cyclic_float_axis_across_seam(self):
result = self.API.retrieve(request)
result.pprint()
assert len(result.leaves) == 1
assert result.leaves[0].flatten()["long"] == (0.5, 0.0)
assert result.leaves[0].flatten()["long"] == (0.0, 0.5)
assert result.leaves[0].result[0] is None
assert result.leaves[0].result[1][0] == 1
assert result.leaves[0].result[1][1] == 0
assert result.leaves[0].result[1][0] == 0
assert result.leaves[0].result[1][1] == 1

0 comments on commit 4e2d75a

Please sign in to comment.