apache_beam.testing.util module¶
Utilities for testing Beam pipelines.
-
class
apache_beam.testing.util.
TestWindowedValue
(value, timestamp, windows)¶ Bases:
tuple
Create new instance of TestWindowedValue(value, timestamp, windows)
-
timestamp
¶ Alias for field number 1
-
value
¶ Alias for field number 0
-
windows
¶ Alias for field number 2
-
-
apache_beam.testing.util.
assert_that
(actual, matcher, label='assert_that', reify_windows=False, use_global_window=True)[source]¶ A PTransform that checks a PCollection has an expected value.
Note that assert_that should be used only for testing pipelines since the check relies on materializing the entire PCollection being checked.
Parameters: - actual – A PCollection.
- matcher – A matcher function taking as argument the actual value of a materialized PCollection. The matcher validates this actual value against expectations and raises BeamAssertException if they are not met.
- label – Optional string label. This is needed in case several assert_that transforms are introduced in the same pipeline.
- reify_windows – If True, matcher is passed a list of TestWindowedValue.
- use_global_window – If False, matcher is passed a dictionary of (k, v) = (window, elements in the window).
Returns: Ignored.