Total Complexity | 4 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Changes | 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 |