• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zopefoundation / zope.component / 3827624917

pending completion
3827624917

push

github

GitHub
Update src/zope/component/tests/test_interface.py

467 of 489 branches covered (95.5%)

Branch coverage included in aggregate %.

4620 of 4625 relevant lines covered (99.89%)

1.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.12
/src/zope/component/testfiles/adapter.py
1
##############################################################################
2
#
3
# Copyright (c) 2004 Zope Foundation and Contributors.
4
# All Rights Reserved.
5
#
6
# This software is subject to the provisions of the Zope Public License,
7
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
8
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11
# FOR A PARTICULAR PURPOSE.
12
#
13
##############################################################################
14
"""Sample adapter class for testing
1✔
15
"""
16

17
from zope.interface import Interface
1✔
18
from zope.interface import implementer
1✔
19

20
from zope.component import adapter
1✔
21
from zope.component.testfiles import components
1✔
22

23
class I1(Interface):
1✔
24
    pass
1✔
25

26
class I2(Interface):
1✔
27
    pass
1✔
28

29
class I3(Interface):
1✔
30
    def f1(): pass
1!
31
    def f2(): pass
1!
32
    def f3(): pass
1!
33

34
class IS(Interface):
1✔
35
    pass
1✔
36

37

38
class Adapter(object):
1✔
39
    def __init__(self, *args):
1✔
40
        self.context = args
1✔
41

42
@implementer(I1)
1✔
43
class A1(Adapter):
1✔
44
    pass
1✔
45

46
@implementer(I2)
1✔
47
class A2(Adapter):
1✔
48
    pass
1✔
49

50
@adapter(components.IContent, I1, I2)
1✔
51
@implementer(I3)
1✔
52
class A3(Adapter):
1✔
53
    pass
1✔
54

55
class A4:
1✔
56
    pass
1✔
57

58
a4 = A4()
1✔
59

60
@implementer(I1, I2)
1✔
61
class A5:
1✔
62
    pass
1✔
63

64
a5 = A5()
1✔
65

66
def Handler(content, *args):
1✔
67
    # uninteresting handler
68
    content.args = getattr(content, 'args', ()) + (args, )
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc