Skip to content

Commit c5faf7d

Browse files
committed
add annotation checks for periodic tendencies
1 parent 6c99526 commit c5faf7d

File tree

5 files changed

+29
-0
lines changed

5 files changed

+29
-0
lines changed

tests/tendencies/periodic/test_periodic_base.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def test_bounds(
6868
else:
6969
assert tendency.base == approx(expected_base)
7070
assert tendency.amplitude == approx(expected_amplitude)
71+
assert not tendency.annotations
7172

7273

7374
@pytest.mark.parametrize(
@@ -116,6 +117,7 @@ def test_bounds_prev(
116117
tendency.set_previous_tendency(prev_tendency)
117118
assert tendency.base == approx(expected_base)
118119
assert tendency.amplitude == approx(expected_amplitude)
120+
assert not tendency.annotations
119121

120122

121123
@pytest.mark.parametrize(
@@ -158,6 +160,7 @@ def test_bounds_next(
158160
)
159161
tendency.set_next_tendency(next_tendency)
160162
assert tendency.base == approx(expected_base)
163+
assert not tendency.annotations
161164

162165

163166
def test_frequency_and_period():
@@ -166,14 +169,17 @@ def test_frequency_and_period():
166169
tendency = PeriodicBaseTendency(user_duration=1, user_frequency=5)
167170
assert tendency.frequency == 5
168171
assert tendency.period == approx(0.2)
172+
assert not tendency.annotations
169173

170174
tendency = PeriodicBaseTendency(user_duration=1, user_period=4)
171175
assert tendency.period == 4
172176
assert tendency.frequency == approx(0.25)
177+
assert not tendency.annotations
173178

174179
tendency = PeriodicBaseTendency(user_duration=1, user_period=2, user_frequency=0.5)
175180
assert tendency.period == 2
176181
assert tendency.frequency == 0.5
182+
assert not tendency.annotations
177183

178184
tendency = PeriodicBaseTendency(user_duration=1, user_period=2, user_frequency=2)
179185
assert tendency.annotations
@@ -190,12 +196,16 @@ def test_phase():
190196

191197
tendency = PeriodicBaseTendency(user_duration=1, user_phase=np.pi / 2)
192198
assert tendency.phase == approx(np.pi / 2)
199+
assert not tendency.annotations
193200

194201
tendency = PeriodicBaseTendency(user_duration=1, user_phase=np.pi)
195202
assert tendency.phase == approx(np.pi)
203+
assert not tendency.annotations
196204

197205
tendency = PeriodicBaseTendency(user_duration=1, user_phase=2 * np.pi)
198206
assert tendency.phase == approx(0)
207+
assert not tendency.annotations
199208

200209
tendency = PeriodicBaseTendency(user_duration=1, user_phase=3 * np.pi)
201210
assert tendency.phase == approx(np.pi)
211+
assert not tendency.annotations

tests/tendencies/periodic/test_sawtooth_wave.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def test_start_and_end():
1515
assert tendency.end_value == approx(0)
1616
assert tendency.start_derivative == approx(2)
1717
assert tendency.end_derivative == approx(2)
18+
assert not tendency.annotations
1819

1920
tendency = SawtoothWaveTendency(
2021
user_duration=1,
@@ -27,6 +28,7 @@ def test_start_and_end():
2728
assert tendency.end_value == approx(0.5)
2829
assert tendency.start_derivative == approx(2)
2930
assert tendency.end_derivative == approx(2)
31+
assert not tendency.annotations
3032

3133
tendency = SawtoothWaveTendency(
3234
user_duration=1,
@@ -39,6 +41,7 @@ def test_start_and_end():
3941
assert tendency.end_value == approx(0.25)
4042
assert tendency.start_derivative == approx(2)
4143
assert tendency.end_derivative == approx(2)
44+
assert not tendency.annotations
4245

4346

4447
def test_generate():
@@ -56,3 +59,4 @@ def test_generate():
5659
time, values = tendency.get_value()
5760
assert np.allclose(time, [0, 0.25, 0.25, 1])
5861
assert np.allclose(values, [4.5, 6, 0, 4.5])
62+
assert not tendency.annotations

tests/tendencies/periodic/test_sine_wave.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def test_start_and_end():
1515
assert tendency.end_value == approx(0)
1616
assert tendency.start_derivative == approx(2 * np.pi)
1717
assert tendency.end_derivative == approx(2 * np.pi)
18+
assert not tendency.annotations
1819

1920
tendency = SineWaveTendency(
2021
user_duration=1,
@@ -27,6 +28,7 @@ def test_start_and_end():
2728
assert tendency.end_value == approx(1)
2829
assert tendency.start_derivative == approx(0)
2930
assert tendency.end_derivative == approx(0)
31+
assert not tendency.annotations
3032

3133
tendency = SineWaveTendency(
3234
user_duration=1,
@@ -39,6 +41,7 @@ def test_start_and_end():
3941
assert tendency.end_value == approx(0)
4042
assert tendency.start_derivative == approx(-2 * np.pi)
4143
assert tendency.end_derivative == approx(-2 * np.pi)
44+
assert not tendency.annotations
4245

4346

4447
def test_generate():
@@ -51,11 +54,13 @@ def test_generate():
5154
time, values = tendency.get_value()
5255
assert np.all(time == np.linspace(0, 1, 101))
5356
assert np.allclose(values, 2 + 3 * np.sin(2 * np.pi * time + 1))
57+
assert not tendency.annotations
5458

5559

5660
def test_declarative_assignment():
5761
tendency = SineWaveTendency(user_duration=1, user_amplitude=10, user_frequency=1)
5862
assert tendency.start_value == approx(0)
63+
assert not tendency.annotations
5964

6065
tendency.user_base = 12
6166
assert tendency.start_value == approx(12)

tests/tendencies/periodic/test_square_wave.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def test_start_and_end():
1414
assert tendency.end_value == 1
1515
assert tendency.start_derivative == 0
1616
assert tendency.end_derivative == 0
17+
assert not tendency.annotations
1718

1819
tendency = SquareWaveTendency(
1920
user_duration=1.75, user_base=0, user_amplitude=1, user_frequency=1
@@ -22,6 +23,7 @@ def test_start_and_end():
2223
assert tendency.end_value == -1
2324
assert tendency.start_derivative == 0
2425
assert tendency.end_derivative == 0
26+
assert not tendency.annotations
2527

2628
tendency = SquareWaveTendency(
2729
user_duration=1,
@@ -34,6 +36,7 @@ def test_start_and_end():
3436
assert tendency.end_value == 1
3537
assert tendency.start_derivative == 0
3638
assert tendency.end_derivative == 0
39+
assert not tendency.annotations
3740

3841
tendency = SquareWaveTendency(
3942
user_duration=1,
@@ -46,6 +49,7 @@ def test_start_and_end():
4649
assert tendency.end_value == -1
4750
assert tendency.start_derivative == 0
4851
assert tendency.end_derivative == 0
52+
assert not tendency.annotations
4953

5054

5155
def test_generate():
@@ -63,3 +67,4 @@ def test_generate():
6367
time, values = tendency.get_value()
6468
assert np.allclose(time, [0, 0.25, 0.25, 0.75, 0.75, 1.25, 1.25, 1.5])
6569
assert np.allclose(values, [5, 5, -1, -1, 5, 5, -1, -1])
70+
assert not tendency.annotations

tests/tendencies/periodic/test_triangle_wave.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def test_start_and_end():
1515
assert tendency.end_value == approx(0)
1616
assert tendency.start_derivative == approx(4)
1717
assert tendency.end_derivative == approx(4)
18+
assert not tendency.annotations
1819

1920
tendency = TriangleWaveTendency(
2021
user_duration=1,
@@ -27,6 +28,7 @@ def test_start_and_end():
2728
assert tendency.end_value == approx(0.5)
2829
assert tendency.start_derivative == approx(4)
2930
assert tendency.end_derivative == approx(4)
31+
assert not tendency.annotations
3032

3133
tendency = TriangleWaveTendency(
3234
user_duration=1,
@@ -39,6 +41,7 @@ def test_start_and_end():
3941
assert tendency.end_value == approx(0)
4042
assert tendency.start_derivative == approx(-4)
4143
assert tendency.end_derivative == approx(-4)
44+
assert not tendency.annotations
4245

4346
tendency = TriangleWaveTendency(
4447
user_duration=1.5,
@@ -51,6 +54,7 @@ def test_start_and_end():
5154
assert tendency.end_value == approx(0)
5255
assert tendency.start_derivative == approx(-4)
5356
assert tendency.end_derivative == approx(4)
57+
assert not tendency.annotations
5458

5559

5660
def test_generate():
@@ -68,3 +72,4 @@ def test_generate():
6872
time, values = tendency.get_value()
6973
assert np.allclose(time, [0, 0.25, 0.75, 1.25, 1.5])
7074
assert np.allclose(values, [6, 9, 3, 9, 6])
75+
assert not tendency.annotations

0 commit comments

Comments
 (0)