为什么我的 PAssert 与我的 PCollection 中的项目不匹配?
Why does my PAssert not match an item in my PCollection?
我有一个 PCollection,我确定它包含:
- "Bob"
- "John"
- "Fred"
但是,当我使用以下方法测试一个询问 "Bob" 是否在 PCollection 中的断言时:
PAssert.that(myPcollection).containsInAnyOrder("Bob")
我们断言失败。由于 "Bob" 在 PCollection 中,为什么会失败?
containsInAnyOrder()
函数用于确定源 PCollection 包含 所有 项目,而不仅仅是项目的子集。不要将其视为 "Does it contain the elements I listed?",而应将其视为 "Is this PCollection completely made up of all the elements I listed (but in any order)".
我有一个 PCollection,我确定它包含:
- "Bob"
- "John"
- "Fred"
但是,当我使用以下方法测试一个询问 "Bob" 是否在 PCollection 中的断言时:
PAssert.that(myPcollection).containsInAnyOrder("Bob")
我们断言失败。由于 "Bob" 在 PCollection 中,为什么会失败?
containsInAnyOrder()
函数用于确定源 PCollection 包含 所有 项目,而不仅仅是项目的子集。不要将其视为 "Does it contain the elements I listed?",而应将其视为 "Is this PCollection completely made up of all the elements I listed (but in any order)".