def test_class_buoyancy_should_report_correct_buoyancy(): b = Buoyancy() expected_buoyancy = 10052 buoyancy = b.calculate_buoyancy(1.0, 1025) assert np.isclose(expected_buoyancy, buoyancy, rtol=1e-1, atol=1e-2, equal_nan=False)
def test_calculate_buoyancy_should_fail_for_invalid_density(): b = Buoyancy() with pytest.raises(ValueError): b.calculate_buoyancy(100, 'b')
def test_calculate_buoyancy_should_fail_for_invalid_volume(): b = Buoyancy() with pytest.raises(ValueError): b.calculate_buoyancy('a', 10)