1
# pragma: no cover
2 2
"""
3
Implement basic assertions to be used in assertion action
4
"""
5

6

7 2
def eq(value, other):
8
    """Equal"""
9 2
    return value == other
10

11

12 2
def ne(value, other):
13
    """Not equal"""
14 2
    return value != other
15

16

17 2
def gt(value, other):
18
    """Greater than"""
19 2
    return value > other
20

21

22 2
def lt(value, other):
23
    """Lower than"""
24 2
    return value < other
25

26

27 2
def gte(value, other):
28
    """Greater than or equal"""
29 2
    return value >= other
30

31

32 2
def lte(value, other):
33
    """Lower than or equal"""
34 2
    return value <= other
35

36

37 2
def identity(value, other):
38
    """Identity check using ID"""
39 2
    return value is other
40

41

42 2
def is_type_of(value, other):
43
    """Type check"""
44 2
    return isinstance(value, other)
45

46

47 2
def is_in(value, other):
48
    """Existence"""
49 2
    return value in other
50

51

52 2
def is_not_in(value, other):
53
    """Inexistence"""
54 2
    return value not in other
55

56

57 2
def cont(value, other):
58
    """Contains"""
59 2
    return other in value
60

61

62 2
def len_eq(value, other):
63
    """Length Equal"""
64 2
    return len(value) == other
65

66

67 2
def len_ne(value, other):
68
    """Length Not equal"""
69 2
    return len(value) != other
70

71

72 2
def len_min(value, other):
73
    """Minimum length"""
74 2
    return len(value) >= other
75

76

77 2
def len_max(value, other):
78
    """Maximum lenght"""
79 2
    return len(value) <= other
80

81

82 2
def startswith(value, term):
83
    """returns value.startswith(term) result"""
84 2
    return value.startswith(term)

Read our documentation on viewing source code .

Loading