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

tests.test_basics.test_falsy()   A

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nop 0
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