def _test_dedup_str(self, deduped, deduper, key=None):
    'Test filter_unique results for str.'
    if (not key):
        key = passthrough
    self.assertEqual(len(deduped), 0)
    self.assertEqual(next(deduper), '1')
    self.assertEqual(next(deduper), '3')
    if (key in (hash, passthrough)):
        if isinstance(deduped, collections.Mapping):
            self.assertEqual(deduped.keys(), [key('1'), key('3')])
        else:
            self.assertEqual(deduped, set([key('1'), key('3')]))
    self.assertEqual(next(deduper), '2')
    self.assertEqual(next(deduper), '4')
    if (key in (hash, passthrough)):
        if isinstance(deduped, collections.Mapping):
            self.assertEqual(deduped.keys(), [key(i) for i in self.strs])
        else:
            self.assertEqual(deduped, set((key(i) for i in self.strs)))
    self.assertRaises(StopIteration, next, deduper)
Test filter_unique results for str.
def _test_dedup_str(self, deduped, deduper, key=None):
    
    if (not key):
        key = passthrough
    self.assertEqual(len(deduped), 0)
    self.assertEqual(next(deduper), '1')
    self.assertEqual(next(deduper), '3')
    if (key in (hash, passthrough)):
        if isinstance(deduped, collections.Mapping):
            self.assertEqual(deduped.keys(), [key('1'), key('3')])
        else:
            self.assertEqual(deduped, set([key('1'), key('3')]))
    self.assertEqual(next(deduper), '2')
    self.assertEqual(next(deduper), '4')
    if (key in (hash, passthrough)):
        if isinstance(deduped, collections.Mapping):
            self.assertEqual(deduped.keys(), [key(i) for i in self.strs])
        else:
            self.assertEqual(deduped, set((key(i) for i in self.strs)))
    self.assertRaises(StopIteration, next, deduper)