|
10 | 10 |
|
11 | 11 |
|
12 | 12 | @patch("matplotlib.pyplot.show") |
13 | | -def test_elliptical_fins(mock_show, calisto_robust, calisto_trapezoidal_fins): # pylint: disable=unused-argument |
| 13 | +def test_elliptical_fins( |
| 14 | + mock_show, calisto_robust, calisto_trapezoidal_fins |
| 15 | +): # pylint: disable=unused-argument |
14 | 16 | test_rocket = calisto_robust |
15 | 17 | calisto_robust.aerodynamic_surfaces.remove(calisto_trapezoidal_fins) |
16 | 18 | test_rocket.add_elliptical_fins(4, span=0.100, root_chord=0.120, position=-1.168) |
@@ -370,6 +372,40 @@ def test_add_motor(calisto_motorless, cesaroni_m1670): |
370 | 372 | assert center_of_mass_motorless is not center_of_mass_with_motor |
371 | 373 |
|
372 | 374 |
|
| 375 | +def test_check_missing_all_components(calisto_motorless): |
| 376 | + """Tests the _check_missing_components method for a Rocket with no components.""" |
| 377 | + with pytest.warns(UserWarning) as record: |
| 378 | + calisto_motorless._check_missing_components() |
| 379 | + |
| 380 | + assert len(record) == 1 |
| 381 | + msg = str(record[0].message) |
| 382 | + assert "motor" in msg |
| 383 | + assert "parachutes" in msg |
| 384 | + assert "aerodynamic surfaces" in msg |
| 385 | + |
| 386 | + |
| 387 | +def test_check_missing_some_components(calisto): |
| 388 | + """Tests the _check_missing_components method for a Rocket missing some components.""" |
| 389 | + calisto.parachutes = [] |
| 390 | + calisto.aerodynamic_surfaces = [] |
| 391 | + |
| 392 | + with pytest.warns(UserWarning) as record: |
| 393 | + calisto._check_missing_components() |
| 394 | + |
| 395 | + assert len(record) == 1 |
| 396 | + msg = str(record[0].message) |
| 397 | + assert "parachutes" in msg |
| 398 | + assert "aerodynamic surfaces" in msg |
| 399 | + |
| 400 | + |
| 401 | +def test_check_missing_no_components_missing(calisto_robust): |
| 402 | + """Tests the _check_missing_components method for a complete Rocket.""" |
| 403 | + # Call directly — no warnings expected |
| 404 | + calisto_robust._check_missing_components() |
| 405 | + # If any warning occurs, pytest will fail automatically |
| 406 | + assert True |
| 407 | + |
| 408 | + |
373 | 409 | def test_set_rail_button(calisto): |
374 | 410 | rail_buttons = calisto.set_rail_buttons(0.2, -0.5, 30) |
375 | 411 | # assert buttons_distance |
|
0 commit comments