View source on GitHub |
Tests ordering against user-provided disjoint ordered groups or items.
cirq.testing.OrderTester()
Methods
add_ascending
add_ascending(
*items
)
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
add_ascending_equivalence_group(
*group_items
)
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. |