summaryrefslogtreecommitdiff
path: root/tests/run/richcmp_str_equals.py
blob: f6539f4a8bdf464cf9925048956bb1fbc1eeebfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# mode: run

class plop(object):
    def __init__(self):
        pass

class testobj(object):
    def __init__(self):
        pass

    def __eq__(self, other):
        return plop()

def test_equals(x):
    """
    >>> x = testobj()
    >>> result = test_equals(x)
    >>> isinstance(result, plop)
    True
    >>> test_equals('hihi')
    False
    >>> test_equals('coucou')
    True
    """
    eq = x == 'coucou'  # not every str equals returns a bool ...
    return eq