cirq.testing.OrderTester

Tests ordering against user-provided disjoint ordered groups or items.

Methods

add_ascending

View source

Tries to add a sequence of ascending items to the order tester.

This methods asserts that items must all be ascending with regard to both each other and the elements which have been already added during previous calls. Some of the previously added elements might be equivalence groups, which are supposed to be equal to each other within that group.

Args
*items The sequence of strictly ascending items.

Raises
AssertionError Items are not ascending either with regard to each other, or with regard to the elements which have been added before.

add_ascending_equivalence_group

View source

Tries to add an ascending equivalence group to the order tester.

Asserts that the group items are equal to each other, but strictly ascending with regard to the already added groups.

Adds the objects as a group.

Args
group_items items making the equivalence group

Raises
AssertionError The group elements aren't equal to each other, or items in another group overlap with the new group.