示例#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('') == ''
def test_to_date_str_with_string_num_as_input() -> str:
    assert to_date_str('{}'.format(_TIMESTAMP)) == _STR
def test_to_date_str_with_string_as_input() -> str:
    assert to_date_str('abcd') == ''
def test_to_date_str_with_empty_string_as_input() -> str:
    assert to_date_str('') == ''
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