TestStr2Dt   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 20
rs 10
wmc 8

4 Methods

Rating   Name   Duplication   Size   Complexity  
A test_title_returns_valid() 0 5 2
A test_title_returns_invalid() 0 3 2
A test_title_returns_invalid_nonetype_str2() 0 3 2
A test_title_returns_invalid_nonetype_str() 0 3 2
1
"""Test munging filters."""
2
3
from dateutil.parser import parse as dtparse
4
5
from flask_extras.filters import datetimes
6
7
8
class TestStr2Dt:
9
    """All tests for str2dt function."""
10
11
    def test_title_returns_valid(self):
12
        """Test function."""
13
        timestr = '01-05-1900 00:00:00'
14
        res = datetimes.str2dt(timestr)
15
        assert res == dtparse(timestr) == res
16
17
    def test_title_returns_invalid(self):
18
        """Test function."""
19
        assert datetimes.str2dt(None) is None
20
21
    def test_title_returns_invalid_nonetype_str(self):
22
        """Test function."""
23
        assert datetimes.str2dt('None') is None
24
25
    def test_title_returns_invalid_nonetype_str2(self):
26
        """Test function."""
27
        assert datetimes.str2dt('null') is None
28