-
Notifications
You must be signed in to change notification settings - Fork 7
/
tests.py
71 lines (49 loc) · 1.29 KB
/
tests.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from nose.tools import *
from jadi import *
@service
class TestService(object):
def __init__(self, context):
pass
@interface
class TestInterface(object):
def __init__(self, context):
pass
@interface
class TestInterface2(object):
def __init__(self, context):
pass
@component(TestInterface)
class TestComponent(object):
def __init__(self, context):
pass
@component(TestInterface)
class TestComponent2(object):
def __init__(self, context):
pass
@component(TestInterface)
class TestComponent3(object):
def __init__(self, context):
pass
@classmethod
def __verify__(cls):
return False
def fqdn_test():
class Test:
pass
eq_(get_fqdn(Test), 'tests.Test')
def service_test():
ctx = Context()
assert isinstance(TestService.get(ctx), TestService)
eq_(TestService.get(ctx), TestService.get(ctx))
def component_test():
ctx = Context()
all = TestInterface.all(ctx)
eq_(len(all), 2)
assert isinstance(all[0], TestComponent)
assert isinstance(all[1], TestComponent2)
any = TestInterface.any(ctx)
assert isinstance(any, TestComponent)
assert isinstance(TestComponent.get(ctx), TestComponent)
@raises(NoImplementationError)
def exc_test():
TestInterface2.any(Context())