hypothesis_ros package

Submodules

hypothesis_ros.message_fields module

Provides hypothesis strategies for ROS1 message fields.

hypothesis_ros.message_fields.FLOAT32_MAX_VALUE = 3.4e+38

float – Maximal Float32 value.

hypothesis_ros.message_fields.FLOAT32_MIN_VALUE = -3.4e+38

float – Minimal Float32 value.

hypothesis_ros.message_fields.FLOAT64_MAX_VALUE = 1.7e+308

float – Maximal Float32 value.

hypothesis_ros.message_fields.FLOAT64_MIN_VALUE = -1.7e+308

float – Minimal Float32 value.

hypothesis_ros.message_fields.INT16_MAX_VALUE = 32767

int – Maximal Int16 value.

hypothesis_ros.message_fields.INT16_MIN_VALUE = -32768

int – Minimal Int16 value.

hypothesis_ros.message_fields.INT32_MAX_VALUE = 2147483647

int – Maximal Int32 value.

hypothesis_ros.message_fields.INT32_MIN_VALUE = -2147483648

int – Minimal Int32 value.

hypothesis_ros.message_fields.INT64_MAX_VALUE = 9223372036854775807L

long – Maximal Int64 value.

hypothesis_ros.message_fields.INT64_MIN_VALUE = -9223372036854775808L

long – Minimal Int64 value.

hypothesis_ros.message_fields.INT8_MAX_VALUE = 127

int – Maximal Int8 value.

hypothesis_ros.message_fields.INT8_MIN_VALUE = -128

int – Minimal Int8 value.

hypothesis_ros.message_fields.STRING_MAX_SIZE = 1000

int – Maximal string size.

hypothesis_ros.message_fields.STRING_MIN_SIZE = 0

int – Minimal string size.

hypothesis_ros.message_fields.UINT16_MAX_VALUE = 65535

int – Maximal UInt16 value.

hypothesis_ros.message_fields.UINT16_MIN_VALUE = 0

int – Minimal UInt16 value.

hypothesis_ros.message_fields.UINT32_MAX_VALUE = 4294967295

int – Maximal UInt32 value.

hypothesis_ros.message_fields.UINT32_MIN_VALUE = 0

int – Minimal UInt32 value.

hypothesis_ros.message_fields.UINT64_MAX_VALUE = 18446744073709551615L

long – Maximal UInt64 value.

hypothesis_ros.message_fields.UINT64_MIN_VALUE = 0

long – Minimal UInt64 value.

hypothesis_ros.message_fields.UINT8_MAX_VALUE = 255

int – Maximal UInt8 value.

hypothesis_ros.message_fields.UINT8_MIN_VALUE = 0

int – Minimal UInt8 value.

hypothesis_ros.message_fields.array(elements=None, min_size=None, max_size=None, unique_by=None, unique=None)[source]

Generate variable length array with ROS1 builtin message types as elements. To generate a fixed length array define min_size == max_size.

TODO: Assert that strategy for elements is from supported strategies.

Parameters:
  • elements (hypothesis_ros.message_fields) – Strategies for pritive types from hypothesis_ros.message_fields.
  • min_size (integer) – Minimal size of the array.
  • max_size (integer) – Maximal size of the array.
  • unique_by (callable) – Function returning a hashable type when given a value from elements. The resulting array (list) will satisfy unique_by(result[i]) != unique_by(result[j]).
  • unique (boolean) – Function returning a hashable type. For comparison of directy object equality.
Returns:

A variable or fixed length array containing values drawn from elements with length in the interval [min_size, max_size] (no bounds in that direction if these are None).

Return type:

list

hypothesis_ros.message_fields.bool()[source]

Generate value for ROS1 builtin message type “bool”.

Returns:Strategy with preconfigured default values.
Return type:hypothesis.strategies.booleans()
hypothesis_ros.message_fields.duration(secs=int32(), nsecs=int32())[source]

Generate value for ROS1 builtin message type “duration”.

Parameters:
  • secs (hypothesis_ros.message_fields.int32()) – Seconds.
  • nsecs (hypothesis_ros.message_fields.int32()) – Nano seconds.
Returns:

Namedtuple with drawn values for secs and nsecs.

Return type:

_Duration()

hypothesis_ros.message_fields.float32(min_value=-3.4e+38, max_value=3.4e+38, allow_nan=False, allow_infinity=False)[source]

Generate value for ROS1 builtin message type “float32”.

TODO: Map Hypothesis values to YAML [.inf, -.Inf, .NAN].
http://www.yaml.org/refcard.html
Parameters:
  • min_value (int) – Minimal value to generate.
  • max_value (int) – Maximal value to generate.
  • allow_nan (boolean) – Generate “not a number”? (Default: false)
  • allow_infinity (boolean) – Generate “not a number”? (Default: false)
Returns:

Strategy with preconfigured default values.

Return type:

hypothesis.strategies.floats()

hypothesis_ros.message_fields.float64(min_value=-1.7e+308, max_value=1.7e+308, allow_nan=False, allow_infinity=False)[source]

Generate value for ROS1 builtin message type “float64”.

TODO: Map Hypothesis values to YAML [.inf, -.Inf, .NAN].
http://www.yaml.org/refcard.html
Parameters:
  • min_value (int) – Minimal value to generate.
  • max_value (int) – Maximal value to generate.
  • allow_nan (boolean) – Generate “not a number”? (Default: false)
  • allow_infinity (boolean) – Generate “not a number”? (Default: false)
Returns:

Strategy with preconfigured default values.

Return type:

hypothesis.strategies.floats()

hypothesis_ros.message_fields.int16(min_value=-32768, max_value=32767)[source]

Generate value for ROS1 builtin message type “int16”.

Parameters:
  • min_value (int) – Minimal value to generate.
  • max_value (int) – Maximal value to generate.
Returns:

Strategy with preconfigured default values.

Return type:

hypothesis.strategies.integers()

hypothesis_ros.message_fields.int32(min_value=-2147483648, max_value=2147483647)[source]

Generate value for ROS1 builtin message type “int32”.

Parameters:
  • min_value (int) – Minimal value to generate.
  • max_value (int) – Maximal value to generate.
Returns:

Strategy with preconfigured default values.

Return type:

hypothesis.strategies.integers()

hypothesis_ros.message_fields.int64(min_value=-9223372036854775808L, max_value=9223372036854775807L)[source]

Generate value for ROS1 builtin message type “int64”.

Parameters:
  • min_value (int) – Minimal value to generate.
  • max_value (int) – Maximal value to generate.
Returns:

Strategy with preconfigured default values.

Return type:

hypothesis.strategies.integers()

hypothesis_ros.message_fields.int8(min_value=-128, max_value=127)[source]

Generate value for ROS1 builtin message type “int8”.

Parameters:
  • min_value (int) – Minimal value to generate.
  • max_value (int) – Maximal value to generate.
Returns:

Strategy with preconfigured default values.

Return type:

hypothesis.strategies.integers()

hypothesis_ros.message_fields.string(min_size=0, max_size=1000)[source]

Generate value for ROS1 builtin message type “string”.

Parameters:
  • min_size (int) – Minimal size to generate.
  • max_size (int) – Maximal size to generate.
Returns:

Strategy with preconfigured default values.

Return type:

hypothesis.strategies.binary()

hypothesis_ros.message_fields.time(secs=uint32(), nsecs=uint32())[source]

Generate value for ROS1 builtin message type “time”.

Parameters:
  • secs (hypothesis_ros.message_fields.uint32()) – Seconds.
  • nsecs (hypothesis_ros.message_fields.uint32()) – Nano seconds.
Returns:

Strategy with preconfigured default values.

Return type:

_Time() # TODO hypothesis_ros.message_fields._Time()

hypothesis_ros.message_fields.uint16(min_value=0, max_value=65535)[source]

Generate value for ROS1 builtin message type “uint16”.

Parameters:
  • min_value (int) – Minimal value to generate.
  • max_value (int) – Maximal value to generate.
Returns:

Strategy with preconfigured default values.

Return type:

hypothesis.strategies.integers()

hypothesis_ros.message_fields.uint32(min_value=0, max_value=4294967295)[source]

Generate value for ROS1 builtin message type “uint32”.

Parameters:
  • min_value (int) – Minimal value to generate.
  • max_value (int) – Maximal value to generate.
Returns:

Strategy with preconfigured default values.

Return type:

hypothesis.strategies.integers()

hypothesis_ros.message_fields.uint64(min_value=0, max_value=18446744073709551615L)[source]

Generate value for ROS1 builtin message type “uint64”.

Parameters:
  • min_value (int) – Minimal value to generate.
  • max_value (int) – Maximal value to generate.
Returns:

Strategy with preconfigured default values.

Return type:

hypothesis.strategies.integers()

hypothesis_ros.message_fields.uint8(min_value=0, max_value=255)[source]

Generate value for ROS1 builtin message type “uint8”.

Parameters:
  • min_value (int) – Minimal value to generate.
  • max_value (int) – Maximal value to generate.
Returns:

Strategy with preconfigured default values.

Return type:

hypothesis.strategies.integers()

hypothesis_ros.parameters module

Provides hypothesis strategies for ROS1 parameter types.

hypothesis_ros.parameters.int32(min_value=-2147483648, max_value=2147483647)[source]

Generate value for ROS1 builtin message type “int32”.

Parameters:
  • min_value (int) – Minimal value to generate.
  • max_value (int) – Maximal value to generate.
Returns:

Strategy with preconfigured default values.

Return type:

hypothesis.strategies.integers()

hypothesis_ros.parameters.string(min_size=0, max_size=1000)[source]

Generate value for ROS1 builtin message type “string”.

Parameters:
  • min_size (int) – Minimal size to generate.
  • max_size (int) – Maximal size to generate.
Returns:

Strategy with preconfigured default values.

Return type:

hypothesis.strategies.binary()

hypothesis_ros.parameters.bool()[source]

Generate value for ROS1 builtin message type “bool”.

Returns:Strategy with preconfigured default values.
Return type:hypothesis.strategies.booleans()
hypothesis_ros.parameters.list(elements=None, min_size=None, max_size=None, unique_by=None, unique=None)

Generate variable length array with ROS1 builtin message types as elements. To generate a fixed length array define min_size == max_size.

TODO: Assert that strategy for elements is from supported strategies.

Parameters:
  • elements (hypothesis_ros.message_fields) – Strategies for pritive types from hypothesis_ros.message_fields.
  • min_size (integer) – Minimal size of the array.
  • max_size (integer) – Maximal size of the array.
  • unique_by (callable) – Function returning a hashable type when given a value from elements. The resulting array (list) will satisfy unique_by(result[i]) != unique_by(result[j]).
  • unique (boolean) – Function returning a hashable type. For comparison of directy object equality.
Returns:

A variable or fixed length array containing values drawn from elements with length in the interval [min_size, max_size] (no bounds in that direction if these are None).

Return type:

list

Module contents