| 31 | } |
| 32 | |
| 33 | auto sequence_to_bounded_int_vector( |
| 34 | const py::sequence& values, |
| 35 | const std::size_t expected_size, |
| 36 | const int minimum_value, |
| 37 | const int maximum_value, |
| 38 | const std::string& field_name) -> std::vector<int> |
| 39 | { |
| 40 | const auto result = sequence_to_int_vector(values, expected_size, field_name); |
| 41 | for (const int value : result) { |
| 42 | if (value < minimum_value || value > maximum_value) { |
| 43 | throw py::value_error( |
| 44 | field_name + " has invalid value " + std::to_string(value) + |
| 45 | " (expected range " + std::to_string(minimum_value) + ".." + |
| 46 | std::to_string(maximum_value) + ")"); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | return result; |
| 51 | } |
| 52 | |
| 53 | auto dict_to_deal(const py::dict& deal_input) -> Deal |
| 54 | { |
no test coverage detected