コード例 #1
0
ファイル: test_output.py プロジェクト: jaredlovell/curvature
def test_get_length_weighted_collection_tags_many_ways(road_a, road_b):
    # road_a length == 4030
    # road_b length == 2160
    output = KmlOutput('km')
    road_c = {
        'id': 1002,
        'tags': {
            'name': 'Road B',
            'highway': 'tertiary',
            'ref': 'VT-555'
        },
        'length': 3000
    }
    road_d = {
        'id': 1003,
        'tags': {
            'name': 'Road A',
            'highway': 'tertiary',
            'ref': 'VT-555'
        },
        'length': 100
    }

    collection = {
        'join_type': 'arbitrary',
        'ways': [road_a, road_b, road_c, road_d]
    }
    names = output.get_length_weighted_collection_tags(collection, 'name')
    assert names == ['Road B', 'Road A']
コード例 #2
0
ファイル: test_output.py プロジェクト: Fonsan/curvature
def test_get_length_weighted_collection_tags(road_a, road_b):
    # road_a length == 4030
    # road_b length == 2160
    output = KmlOutput('km')
    collection = {'join_type': 'arbitrary', 'ways': [road_a, road_b]}
    names = output.get_length_weighted_collection_tags(collection, 'name')
    assert names == ['Road A', 'Road B']

    # Ensure that reversing the ways doesn't change anything.
    collection = {'join_type': 'arbitrary', 'ways': [road_b, road_a]}
    names = output.get_length_weighted_collection_tags(collection, 'name')
    assert names == ['Road A', 'Road B']

    # Ensure that giving B a larger length does change the order.
    road_b['length'] = 5000
    collection = {'join_type': 'arbitrary', 'ways': [road_a, road_b]}
    names = output.get_length_weighted_collection_tags(collection, 'name')
    assert names == ['Road B', 'Road A']
コード例 #3
0
ファイル: test_output.py プロジェクト: jaredlovell/curvature
def test_get_length_weighted_collection_tags(road_a, road_b):
    # road_a length == 4030
    # road_b length == 2160
    output = KmlOutput('km')
    collection = {'join_type': 'arbitrary', 'ways': [road_a, road_b]}
    names = output.get_length_weighted_collection_tags(collection, 'name')
    assert names == ['Road A', 'Road B']

    # Ensure that reversing the ways doesn't change anything.
    collection = {'join_type': 'arbitrary', 'ways': [road_b, road_a]}
    names = output.get_length_weighted_collection_tags(collection, 'name')
    assert names == ['Road A', 'Road B']

    # Ensure that giving B a larger length does change the order.
    road_b['length'] = 5000
    collection = {'join_type': 'arbitrary', 'ways': [road_a, road_b]}
    names = output.get_length_weighted_collection_tags(collection, 'name')
    assert names == ['Road B', 'Road A']
コード例 #4
0
ファイル: test_output.py プロジェクト: Fonsan/curvature
def test_get_length_weighted_collection_tags_many_ways(road_a, road_b):
    # road_a length == 4030
    # road_b length == 2160
    output = KmlOutput('km')
    road_c = {'id':   1002,
            'tags': {   'name':     'Road B',
                        'highway':  'tertiary',
                        'ref':      'VT-555'},
            'length': 3000}
    road_d = {'id':   1003,
            'tags': {   'name':     'Road A',
                        'highway':  'tertiary',
                        'ref':      'VT-555'},
            'length': 100}

    collection = {'join_type': 'arbitrary', 'ways': [road_a, road_b, road_c, road_d]}
    names = output.get_length_weighted_collection_tags(collection, 'name')
    assert names == ['Road B', 'Road A']