basic reimplementation of what was working in rdc.etl, jupyter widget, json import, demo with opendatasoft api, etc. Lot of things are still work in progress, stay tuned.
This commit is contained in:
24
tests/core/test_services.py
Normal file
24
tests/core/test_services.py
Normal file
@ -0,0 +1,24 @@
|
||||
from bonobo import inject, service
|
||||
|
||||
|
||||
class MyFoo():
|
||||
pass
|
||||
|
||||
def test_service_is_singleton():
|
||||
@service
|
||||
def foo():
|
||||
return MyFoo()
|
||||
|
||||
assert foo() is foo()
|
||||
|
||||
@inject(foo)
|
||||
def bar(myfoo):
|
||||
assert myfoo is foo()
|
||||
|
||||
bar()
|
||||
|
||||
foo2 = foo.define()
|
||||
|
||||
assert type(foo()) == type(foo2())
|
||||
assert foo2() is not foo()
|
||||
|
||||
Reference in New Issue
Block a user