'Tests that iterating over a query set more than once works'

@execute_count(2)
def test_multiple_iterations_work_properly(self):

    for q in (self.table.objects(test_id=0), self.table.objects((self.table.column('test_id') == 0))):
        compare_set = set([(0, 5), (1, 10), (2, 15), (3, 20)])
        for t in q:
            val = (t.attempt_id, t.expected_result)
            assert (val in compare_set)
            compare_set.remove(val)
        assert (len(compare_set) == 0)
        compare_set = set([(0, 5), (1, 10), (2, 15), (3, 20)])
        for t in q:
            val = (t.attempt_id, t.expected_result)
            assert (val in compare_set)
            compare_set.remove(val)
        assert (len(compare_set) == 0)
