Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You're right to want to avoid duplicating your code inside your test. In this case, I'd work out some simple permutations and test against those values, sorting the results so order doesn't matter.

    assert(sorted(permute((1, 2))) == [(1, 2), (2, 1)])


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: