Matthew Gilson added the comment:

Tracking which group the grouper _should_ be on using an incrementing integer 
seems to work pretty well.

In additional to the tests in `test_itertools.py`, I've gotten the following 
tests to pass:

class TestGroupBy(unittest.TestCase):
    def test_unpacking(self):
        iterable = 'AAAAABBBBB'
        (_, a), (_, b) = groupby(iterable)
        self.assertEqual(list(a), [])
        self.assertEqual(list(b), [])

    def test_weird_iterating(self):
        g = groupby('AAAABBBBAAAAABBBBB')
        _, a = next(g)
        _, b = next(g)
        _, aa = next(g)
        self.assertEqual(list(a), [])
        self.assertEqual(list(b), [])
        self.assertEqual(list(aa), list('AAAAA'))

If I was to submit this as a PR,

1. where would I want to add these tests?
2. should I update the documentation for the "equivalent" python version to 
match exactly?

----------
keywords: +patch
Added file: http://bugs.python.org/file46860/groupby-fix.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30346>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to