Пример #1
0
def test_key_formatter_with_unpack(args, result):
    """Should succeed with unpack=True flag."""
    assert io.key_formatter(*args, unpack=True) == result
Пример #2
0
def test_key_formatter_negative(key, source_format, destination_format):
    """Should raise exception, since it can't either parse source formatter or format to result."""
    with pytest.raises(KeyError):
        io.key_formatter(key, source_format, destination_format)
Пример #3
0
def test_key_formatter(mocker, key, source_format, destination_format, result):
    """Test parsing and usage of default attributes."""
    importlib.reload(io)
    mocked_datetime = mocker.patch("solgate.utils.io.datetime")
    mocked_datetime.now.return_value = datetime.datetime(2020, 1, 1)
    assert io.key_formatter(key, source_format, destination_format) == result