[TIP] Which is the proper way to test an "unordered list"

Herman Sheremetyev herman at swebpage.com
Wed May 16 19:23:05 PDT 2012


Sort both sides?

On Thu, May 17, 2012 at 10:30 AM, Jorge Vargas <jorge.vargas at gmail.com> wrote:
> Hello,
>
> I wrote this tiny decorator which is a simple marker. kind of like
> @exposed if you do webdev. all it does is validate and create a list
> of possible "next_states".
>
> def test_next_two():
>    @next("a state")
>    @next("another state")
>    def a_transition():
>        pass
>    assert a_transition.next_states == ["a state","another state"]
>
> The test above is failing due to the list being reversed.
>
> Of course the simple answer is to flip the values of the static list but...
>
> My question is which will be the proper way to test for this when the
> "order of the list" is not valid?
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python



More information about the testing-in-python mailing list