apache_beam.testing.util module

Utilities for testing Beam pipelines.

apache_beam.testing.util.equal_to(expected)[source]
apache_beam.testing.util.is_empty()[source]
apache_beam.testing.util.assert_that(actual, matcher, label='assert_that')[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.
Returns:

Ignored.

apache_beam.testing.util.open_shards(*args, **kwargs)[source]

Returns a composite file of all shards matching the given glob pattern.