tests.hamcrest_unit_test.collection.QuasiSequence   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 6
Duplicated Lines 0 %
Metric Value
dl 0
loc 6
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __iter__() 0 2 1
A __len__() 0 2 1
1
__author__ = "Jon Reid"
2
__copyright__ = "Copyright 2011 hamcrest.org"
3
__license__ = "BSD, see License.txt"
4
5
import six
6
7
8
class QuasiSequence(object):
9
    def __iter__(self):
10
        return QuasiSequenceIterator()
11
12
    def __len__(self):
13
        return 2
14
15
16
class QuasiSequenceIterator(six.Iterator):
17
    def __init__(self):
18
        self.index = 1
19
20
    def __iter__(self):
21
        return self
22
23
    def __next__(self):
24
        if self.index >= 3:
25
            raise StopIteration
26
        result = self.index
27
        self.index += 1
28
        return result
29