()
| 199 | |
| 200 | @pytest.mark.skipif(not hasattr(m, "has_boost_optional"), reason="no <boost/optional>") |
| 201 | def test_boost_optional(): |
| 202 | assert m.double_or_zero_boost(None) == 0 |
| 203 | assert m.double_or_zero_boost(42) == 84 |
| 204 | pytest.raises(TypeError, m.double_or_zero_boost, "foo") |
| 205 | |
| 206 | assert m.half_or_none_boost(0) is None |
| 207 | assert m.half_or_none_boost(42) == 21 |
| 208 | pytest.raises(TypeError, m.half_or_none_boost, "foo") |
| 209 | |
| 210 | assert m.test_nullopt_boost() == 42 |
| 211 | assert m.test_nullopt_boost(None) == 42 |
| 212 | assert m.test_nullopt_boost(42) == 42 |
| 213 | assert m.test_nullopt_boost(43) == 43 |
| 214 | |
| 215 | assert m.test_no_assign_boost() == 42 |
| 216 | assert m.test_no_assign_boost(None) == 42 |
| 217 | assert m.test_no_assign_boost(m.NoAssign(43)) == 43 |
| 218 | pytest.raises(TypeError, m.test_no_assign_boost, 43) |
| 219 | |
| 220 | holder = m.OptionalBoostHolder() |
| 221 | mvalue = holder.member |
| 222 | assert mvalue.initialized |
| 223 | assert holder.member_initialized() |
| 224 | |
| 225 | props = m.OptionalBoostProperties() |
| 226 | assert int(props.access_by_ref) == 42 |
| 227 | assert int(props.access_by_copy) == 42 |
| 228 | |
| 229 | |
| 230 | def test_reference_sensitive_optional(doc): |
nothing calls this directly
no test coverage detected