Beispiel #1
0
def test_equal_objects_return_false_with_different_array_length():
    assert not equal_objects(
        {'foo': [{
            'id': '1',
            'type': 'network',
            'ignored_field': 'foo'
        }]}, {'foo': []})
Beispiel #2
0
def test_equal_objects_return_true_with_equal_nested_list_of_object_references(
):
    assert equal_objects(
        {
            'name': 'foo',
            'config': {
                'version':
                '1',
                'ports': [{
                    'name': 'oldPortName',
                    'type': 'port',
                    'id': '123'
                }, {
                    'name': 'oldPortName2',
                    'type': 'port',
                    'id': '234'
                }]
            }
        }, {
            'name': 'foo',
            'config': {
                'version':
                '1',
                'ports': [{
                    'name': 'newPortName',
                    'type': 'port',
                    'id': '123'
                }, {
                    'name': 'newPortName2',
                    'type': 'port',
                    'id': '234',
                    'extraField': 'foo'
                }]
            }
        })
Beispiel #3
0
def test_equal_objects_return_true_with_equal_nested_dicts():
    assert equal_objects({'foo': {
        'bar': 1,
        'buz': 2
    }}, {'foo': {
        'buz': 2,
        'bar': 1
    }})
Beispiel #4
0
def test_equal_objects_return_true_with_equal_ref_arrays():
    assert equal_objects(
        {'foo': [{
            'id': '1',
            'type': 'network',
            'ignored_field': 'foo'
        }]}, {'foo': [{
            'id': '1',
            'type': 'network',
            'ignored_field': 'bar'
        }]})
Beispiel #5
0
def test_equal_objects_return_true_with_different_ref_types():
    assert not equal_objects(
        {'foo': {
            'id': '1',
            'type': 'network',
            'ignored_field': 'foo'
        }}, {'foo': {
            'id': '1',
            'type': 'accessRule',
            'ignored_field': 'bar'
        }})
Beispiel #6
0
def test_equal_objects_return_true_with_same_object_refs():
    assert equal_objects(
        {'foo': {
            'id': '1',
            'type': 'network',
            'ignored_field': 'foo'
        }}, {'foo': {
            'id': '1',
            'type': 'network',
            'ignored_field': 'bar'
        }})
Beispiel #7
0
def test_equal_objects_return_true_with_equal_nested_object_references():
    assert equal_objects(
        {
            'name': 'foo',
            'config': {
                'version': '1',
                'port': {
                    'name': 'oldPortName',
                    'type': 'port',
                    'id': '123'
                }
            }
        }, {
            'name': 'foo',
            'config': {
                'version': '1',
                'port': {
                    'name': 'newPortName',
                    'type': 'port',
                    'id': '123'
                }
            }
        })
Beispiel #8
0
def test_equal_objects_return_false_with_different_nested_object_references():
    assert not equal_objects(
        {
            'name': 'foo',
            'config': {
                'version': '1',
                'port': {
                    'name': 'oldPortName',
                    'type': 'port',
                    'id': '123'
                }
            }
        }, {
            'name': 'foo',
            'config': {
                'version': '1',
                'port': {
                    'name': 'oldPortName',
                    'type': 'port',
                    'id': '234'
                }
            }
        })
Beispiel #9
0
def test_equal_objects_return_false_with_different_values():
    assert not equal_objects({'foo': 1}, {'foo': 2})
Beispiel #10
0
def test_equal_objects_return_true_with_ignored_fields():
    assert equal_objects({
        'foo': 1,
        'version': '123',
        'id': '123123'
    }, {'foo': 1})
Beispiel #11
0
def test_equal_objects_return_true_with_equal_lists():
    assert equal_objects({'foo': ['bar']}, {'foo': ['bar']})
Beispiel #12
0
def test_equal_objects_return_true_with_equal_str_like_values():
    assert equal_objects({'foo': b'bar'}, {'foo': u'bar'})
Beispiel #13
0
def test_equal_objects_return_true_with_equal_objects():
    assert equal_objects({'foo': 1, 'bar': 2}, {'bar': 2, 'foo': 1})
Beispiel #14
0
def test_equal_objects_return_false_with_different_list_length():
    assert not equal_objects({'foo': []}, {'foo': ['bar']})
Beispiel #15
0
def test_equal_objects_return_false_with_different_nested_values():
    assert not equal_objects({'foo': {'bar': 1}}, {'foo': {'bar': 2}})
Beispiel #16
0
def test_equal_objects_return_false_with_different_fields():
    assert not equal_objects({'foo': 1}, {'bar': 1})
Beispiel #17
0
def test_equal_objects_return_false_with_different_length():
    assert not equal_objects({'foo': 1}, {'foo': 1, 'bar': 2})