コード例 #1
0
ファイル: test_assertion_utils.py プロジェクト: Arable/flex
def test_multiple_matches_return_all_namespaces():
    errors = {
        'bar': [{'baz': 'foo'}],
        'bop': 'foo',
    }
    path = find_message_in_errors('foo', errors)
    assert set(path) == set(['bop', 'bar.0.baz'])
コード例 #2
0
ファイル: test_assertion_utils.py プロジェクト: wooken/flex
def test_a_complex_nested_match():
    errors = {
        'bar': [{
            'baz': 'foo'
        }],
    }
    path = find_message_in_errors('foo', errors)
    assert set(path) == set(['bar.0.baz'])
コード例 #3
0
ファイル: test_assertion_utils.py プロジェクト: wooken/flex
def test_non_matching_string_returns_empty():
    """
    If a string is passed in as errors, the namespace should be returned if the
    string is a match.
    """
    errors = 'foo'
    path = find_message_in_errors('not-a-match', errors)
    assert set(path) == set([])
コード例 #4
0
ファイル: test_assertion_utils.py プロジェクト: wooken/flex
def test_matched_string_returns_namespace_path():
    """
    If a string is passed in as errors, the namespace should be returned if the
    string is a match.
    """
    errors = 'foo'
    path = find_message_in_errors('foo', errors, namespace='namespace')
    assert set(path) == set(['namespace'])
コード例 #5
0
ファイル: test_assertion_utils.py プロジェクト: Arable/flex
def test_non_matching_string_returns_empty():
    """
    If a string is passed in as errors, the namespace should be returned if the
    string is a match.
    """
    errors = 'foo'
    path = find_message_in_errors('not-a-match', errors)
    assert set(path) == set([])
コード例 #6
0
ファイル: test_assertion_utils.py プロジェクト: Arable/flex
def test_matched_string_returns_namespace_path():
    """
    If a string is passed in as errors, the namespace should be returned if the
    string is a match.
    """
    errors = 'foo'
    path = find_message_in_errors('foo', errors, namespace='namespace')
    assert set(path) == set(['namespace'])
コード例 #7
0
ファイル: test_assertion_utils.py プロジェクト: wooken/flex
def test_multiple_matches_return_all_namespaces():
    errors = {
        'bar': [{
            'baz': 'foo'
        }],
        'bop': 'foo',
    }
    path = find_message_in_errors('foo', errors)
    assert set(path) == set(['bop', 'bar.0.baz'])
コード例 #8
0
ファイル: test_assertion_utils.py プロジェクト: wooken/flex
def test_nested_matches_return_full_namespace():
    errors = {
        'bar': ['foo'],
    }
    path = find_message_in_errors('foo', errors)
    assert set(path) == set(['bar.0'])
コード例 #9
0
ファイル: test_assertion_utils.py プロジェクト: wooken/flex
def test_dictionary_matches_return_element_key():
    errors = {
        'bar': 'foo',
    }
    path = find_message_in_errors('foo', errors)
    assert set(path) == set(['bar'])
コード例 #10
0
ファイル: test_assertion_utils.py プロジェクト: wooken/flex
def test_list_matches_return_element_index():
    errors = ['bar', 'foo']
    path = find_message_in_errors('foo', errors)
    assert set(path) == set(['1'])
コード例 #11
0
ファイル: test_assertion_utils.py プロジェクト: Arable/flex
def test_a_complex_nested_match():
    errors = {
        'bar': [{'baz': 'foo'}],
    }
    path = find_message_in_errors('foo', errors)
    assert set(path) == set(['bar.0.baz'])
コード例 #12
0
ファイル: test_assertion_utils.py プロジェクト: Arable/flex
def test_nested_matches_return_full_namespace():
    errors = {
        'bar': ['foo'],
    }
    path = find_message_in_errors('foo', errors)
    assert set(path) == set(['bar.0'])
コード例 #13
0
ファイル: test_assertion_utils.py プロジェクト: Arable/flex
def test_dictionary_matches_return_element_key():
    errors = {
        'bar': 'foo',
    }
    path = find_message_in_errors('foo', errors)
    assert set(path) == set(['bar'])
コード例 #14
0
ファイル: test_assertion_utils.py プロジェクト: Arable/flex
def test_list_matches_return_element_index():
    errors = ['bar', 'foo']
    path = find_message_in_errors('foo', errors)
    assert set(path) == set(['1'])