def METHOD_NAME(self):
    # the same needles should be listed together:
    counter = dnf.match_counter.MatchCounter()
    pkg1, pkg2, pkg3, pkg4 = PackageStub().several(4)
    counter.add(pkg1, 'summary', 'grin')
    counter.add(pkg2, 'summary', 'foolish')
    counter.add(pkg3, 'summary', 'grin')
    counter.add(pkg4, 'summary', 'grin')
    srt = counter.sorted()
    self.assertEqual(srt.index(pkg2), 1)
    # more unique needles is more than less unique needles:
    counter = dnf.match_counter.MatchCounter()
    counter.add(pkg1, 'summary', 'a')
    counter.add(pkg1, 'summary', 'b')
    counter.add(pkg2, 'summary', 'b')
    counter.add(pkg2, 'summary', 'b')
    self.assertSequenceEqual(counter.sorted(), (pkg1, pkg2))