コード例 #1
0
ファイル: test_format.py プロジェクト: BigRoy/pather
def test_format_invalid_type_exception():
    """Format invalid data value raises TypeError"""

    pattern = "project/{entity}/{task}/{family}"
    data = {"entity": None}

    with assert_raises(TypeError):
        pather.format(pattern, data)
コード例 #2
0
ファイル: test_format.py プロジェクト: satishgoda/pather
def test_format_invalid_type_exception():
    """Format invalid data value raises TypeError"""

    pattern = 'project/{entity}/{task}/{family}'
    data = {'entity': None}

    with assert_raises(TypeError):
        pather.format(pattern, data)
コード例 #3
0
ファイル: test_parse.py プロジェクト: mottosso/pather
def test_format_and_parse():
    """Ensure format and parse are reversable"""

    pattern = "project/{entity}/{task}/output/{family}"
    data = {"entity": "john", "task": "rigging", "family": "review"}

    formatted = pather.format(pattern, data)
    parsed = pather.parse(pattern, formatted)
    assert data == parsed

    formatted_again = pather.format(pattern, parsed)
    assert formatted == formatted_again
コード例 #4
0
def test_format_and_parse():
    """Ensure format and parse are reversable"""

    pattern = 'project/{entity}/{task}/output/{family}'
    data = {'entity': 'john', 'task': 'rigging', 'family': 'review'}

    formatted = pather.format(pattern, data)
    parsed = pather.parse(pattern, formatted)
    assert data == parsed

    formatted_again = pather.format(pattern, parsed)
    assert formatted == formatted_again
コード例 #5
0
ファイル: test_format.py プロジェクト: BigRoy/pather
def test_format_full():
    """Format_full"""

    pattern = "project/{entity}/{task}/{family}"
    data = {"entity": "john", "task": "rigging", "family": "review"}

    formatted = pather.format(pattern, data)
    assert formatted == "project/john/rigging/review"
コード例 #6
0
ファイル: test_format.py プロジェクト: BigRoy/pather
def test_format_unicode():
    """Format pattern and data allows unicode"""

    pattern = unicode("project/{entity}/{task}/{family}")
    data = {unicode("entity"): unicode("john"), unicode("family"): unicode("review")}

    formatted = pather.format(pattern, data)
    assert formatted == "project/john/{task}/review"
コード例 #7
0
ファイル: test_format.py プロジェクト: BigRoy/pather
def test_format_partial():
    """Format partial"""

    pattern = "project/{entity}/{task}/{family}"
    data = {"entity": "john", "family": "review"}

    formatted = pather.format(pattern, data)
    assert formatted == "project/john/{task}/review"
コード例 #8
0
ファイル: test_format.py プロジェクト: satishgoda/pather
def test_format_full():
    """Format_full"""

    pattern = 'project/{entity}/{task}/{family}'
    data = {'entity': 'john', 'task': 'rigging', 'family': 'review'}

    formatted = pather.format(pattern, data)
    assert formatted == 'project/john/rigging/review'
コード例 #9
0
ファイル: test_format.py プロジェクト: satishgoda/pather
def test_format_partial():
    """Format partial"""

    pattern = 'project/{entity}/{task}/{family}'
    data = {'entity': 'john', 'family': 'review'}

    formatted = pather.format(pattern, data)
    assert formatted == 'project/john/{task}/review'
コード例 #10
0
ファイル: test_format.py プロジェクト: mottosso/pather
def test_format_partial():
    """Format partial"""

    pattern = 'project/{entity}/{task}/{family}'
    data = {'entity': 'john',
            'family': 'review'}

    formatted = pather.format(pattern, data)
    assert formatted == 'project/john/{task}/review'
コード例 #11
0
ファイル: test_format.py プロジェクト: mottosso/pather
def test_format_full():
    """Format_full"""

    pattern = 'project/{entity}/{task}/{family}'
    data = {'entity': 'john',
            'task': 'rigging',
            'family': 'review'}

    formatted = pather.format(pattern, data)
    assert formatted == 'project/john/rigging/review'
コード例 #12
0
ファイル: test_format.py プロジェクト: satishgoda/pather
def test_format_unicode():
    """Format pattern and data allows unicode"""

    pattern = unicode('project/{entity}/{task}/{family}')
    data = {
        unicode('entity'): unicode('john'),
        unicode('family'): unicode('review')
    }

    formatted = pather.format(pattern, data)
    assert formatted == 'project/john/{task}/review'