In Python 3.3, if there are duplicate test ids, tests.sort()
will fail and raise TypeError.

Detect the duplicate test ids firstly in sorted_tests() to ensure
that all test ids are unique.