Passed
Pull Request — master (#4)
by Guibert
50s
created

tests.test_basics   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 22
dl 0
loc 32
rs 10
c 0
b 0
f 0

4 Functions

Rating   Name   Duplication   Size   Complexity  
A test_exception_decorator_falsy() 0 5 1
A test_truthy() 0 4 1
A test_falsy() 0 6 1
A test_node_metadata_do_not_change_behavior() 0 7 1
1
from async_btree import FAILURE, SUCCESS, ExceptionDecorator, node_metadata
2
3
4
def test_truthy():
5
    assert SUCCESS
6
    assert Exception()
7
    assert [1, 2]
8
9
10
def test_falsy():
11
    assert not []
12
    assert not bool([])
13
    assert not FAILURE
14
    assert not bool(FAILURE)
15
    assert not bool(ExceptionDecorator(Exception()))
16
17
18
def test_exception_decorator_falsy():
19
    assert bool(Exception())
20
    assert not bool(ExceptionDecorator(Exception()))
21
    assert str(ExceptionDecorator(Exception("test"))) == str(Exception("test"))
22
    assert repr(ExceptionDecorator(Exception("test"))) == repr(Exception("test"))
23
24
25
def test_node_metadata_do_not_change_behavior(kernel):
26
    async def a_func():
27
        return 'a'
28
29
    assert kernel.run(a_func) == 'a'
30
    # no change on behavior
31
    assert kernel.run(node_metadata()(a_func)) == 'a'
32