def test_string(self): inputs = "hey" outputs = [('h', 'e'), ('e', 'y'), ('y', None)] self.assertEqual(list(pairwise(inputs)), outputs)
def test_none(self): inputs = [None, None] outputs = [(None, None), (None, None)] self.assertEqual(list(pairwise(inputs)), outputs)
def test_empty(self): self.assertEqual(list(pairwise([])), [])
def test_one_item(self): self.assertEqual(list(pairwise([1])), [(1, None)])
def test_three(self): inputs = [1, 2, 3] outputs = [(1, 2), (2, 3), (3, None)] self.assertEqual(list(pairwise(inputs)), outputs)