Passed
Pull Request — master (#132)
by
unknown
03:30
created

test_init_with_default_params()   A

Complexity

Conditions 3

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 3
nop 0
1
import pytest
2
3
from datatables import ColumnDT
4
5
from .models import User
6
7
8
def test_init_with_default_params():
9
    """Return column with given default params."""
10
    col = ColumnDT(User.id)
11
12
    if not (col.nulls_order is None or col.search_method == "string_contains"):
13
        raise AssertionError()
14
15
16
def test_with_filter_ok():
17
    """Return column with a specific filter."""
18
    col = ColumnDT(User.name, search_method="like")
19
20
    if col.search_method != "like":
21
        raise AssertionError()
22
23
24
def test_with_valid_nulls_order():
25
    """Return column with a specific filter."""
26
    col = ColumnDT(User.name, nulls_order="nullslast")
27
28
    if col.nulls_order != "nullslast":
29
        raise AssertionError()
30
31
32
def test_with_invalid_nulls_order():
33
    """Return column with a specific filter."""
34
    with pytest.raises(ValueError):
35
        ColumnDT(User.name, nulls_order="invalid")
36
37
38
def test_with_invalid_search_method():
39
    """Return column with a specific filter."""
40
    with pytest.raises(ValueError):
41
        ColumnDT(User.name, search_method="invalid")
42
43
44
# Added by kartikeyas00
45
def test_with_yadcf_data_param():
46
    """Return Column with yadcf_data filter as false."""
47
    col = ColumnDT(User.name, yadcf_data=False)
48
49
    if col.yadcf_data != False:
50
        raise AssertionError()
51