Exemplo n.º 1
0
    def test_alphabet(self):
        data = ['Alef', 'Bet', 'Gimel', 'Dalet', 'He', 'Vav', 'Zayin', 'Het',
                'Tet', 'Yod', 'Kaf', 'Lamed', 'Mem', 'Nun', 'Samekh', 'Ayin',
                'Pe', 'Tsadi', 'Qof', 'Resh', 'Shin', 'Tav']

        a = iter(Alphabet())
        for alpha in data:
            with self.subTest(alpha = alpha):
                self.assertEqual(next(a), alpha)
        self.assertRaises(StopIteration, next, a)
Exemplo n.º 2
0
def test_alphabet():
    data = ['Alef', 'Bet', 'Gimel', 'Dalet', 'He', 'Vav', 'Zayin', 'Het',
            'Tet', 'Yod', 'Kaf', 'Lamed', 'Mem', 'Nun', 'Samekh', 'Ayin',
            'Pe', 'Tsadi', 'Qof', 'Resh', 'Shin', 'Tav']

    a = iter(Alphabet())
    for alpha in data:
        assert next(a) == alpha
    with pytest.raises(StopIteration):
        next(a)
Exemplo n.º 3
0
def test_alphabet_is_iterator():
    assert '__init__' in dir(Alphabet)
    iterator = iter(Alphabet())
    assert '__next__' in dir(iterator)
Exemplo n.º 4
0
 def test_is_iterator(self):
     self.assertIn('__init__', dir(Alphabet))
     iterator = iter(Alphabet())
     self.assertIn('__next__', dir(iterator))