Example #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': []})
Example #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'
                }]
            }
        })
Example #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
    }})
Example #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'
        }]})
Example #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'
        }})
Example #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'
        }})
Example #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'
                }
            }
        })
Example #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'
                }
            }
        })
Example #9
0
def test_equal_objects_return_false_with_different_values():
    assert not equal_objects({'foo': 1}, {'foo': 2})
Example #10
0
def test_equal_objects_return_true_with_ignored_fields():
    assert equal_objects({
        'foo': 1,
        'version': '123',
        'id': '123123'
    }, {'foo': 1})
Example #11
0
def test_equal_objects_return_true_with_equal_lists():
    assert equal_objects({'foo': ['bar']}, {'foo': ['bar']})
Example #12
0
def test_equal_objects_return_true_with_equal_str_like_values():
    assert equal_objects({'foo': b'bar'}, {'foo': u'bar'})
Example #13
0
def test_equal_objects_return_true_with_equal_objects():
    assert equal_objects({'foo': 1, 'bar': 2}, {'bar': 2, 'foo': 1})
Example #14
0
def test_equal_objects_return_false_with_different_list_length():
    assert not equal_objects({'foo': []}, {'foo': ['bar']})
Example #15
0
def test_equal_objects_return_false_with_different_nested_values():
    assert not equal_objects({'foo': {'bar': 1}}, {'foo': {'bar': 2}})
Example #16
0
def test_equal_objects_return_false_with_different_fields():
    assert not equal_objects({'foo': 1}, {'bar': 1})
Example #17
0
def test_equal_objects_return_false_with_different_length():
    assert not equal_objects({'foo': 1}, {'foo': 1, 'bar': 2})