Пример #1
0
 def format(self, value):
     """Converts given epoch to iso8601 string"""
     return to_date_str(value)
Пример #2
0
def test_to_date_str_with_string_as_input() -> str:
    """Test invalid string as date."""
    assert to_date_str('abcd') == ''
Пример #3
0
def test_to_date_str_with_string_num_as_input() -> str:
    """Test number as input."""
    assert to_date_str('{}'.format(_TIMESTAMP)) == _STR
Пример #4
0
def test_to_date_str() -> str:
    """Test date to string."""
    assert to_date_str(_TIMESTAMP) == _STR
Пример #5
0
def test_to_date_str_with_empty_string_as_input() -> str:
    """Test empty string."""
    assert to_date_str('') == ''
Пример #6
0
def test_to_date_str_with_string_num_as_input() -> str:
    assert to_date_str('{}'.format(_TIMESTAMP)) == _STR
Пример #7
0
def test_to_date_str_with_string_as_input() -> str:
    assert to_date_str('abcd') == ''
Пример #8
0
def test_to_date_str_with_empty_string_as_input() -> str:
    assert to_date_str('') == ''
Пример #9
0
def test_to_date_str() -> str:
    assert to_date_str(_TIMESTAMP) == _STR
Пример #10
0
 def format(self, value):
     """Convert given epoch to iso8601 string."""
     return to_date_str(value) if value else None