Example #1
0
def test_merge_to_stream(dict1, method, value, lose, importants, result_dict,
                         final_importants):
    """Test combining stream and metadata dicts."""
    # pylint: disable=too-many-arguments
    testclass = MetaTest(value)
    _merge_to_stream(dict1, getattr(testclass, method), lose, importants)
    assert dict1 == result_dict
    assert importants == final_importants
Example #2
0
def test_merge_normal_conflict():
    """Test adding metadata to stream with conflicting unimportant values."""
    testclass = MetaTest("newvalue")
    with pytest.raises(ValueError) as error:
        _merge_to_stream({"key_notimportant": "oldvalue"},
                         getattr(testclass, "key_notimportant"), [], {})
    assert ("Conflict with existing value 'oldvalue' and new value 'newvalue'"
            in six.text_type(error.value))
Example #3
0
def test_merge_to_stream(meta_dict, method, value, lose, result_dict,
                         final_importants):
    """
    Test combining stream and metadata dicts.

    :meta_dict: Stream metadata dict
    :method: Method name which result will be merged
    :lose: Lose values
    :result_dict: Resulted stream metadata after merge
    :final_importants: Resulted important metadata
    """
    # pylint: disable=too-many-arguments
    testclass = MetaTest(value)
    _merge_to_stream(meta_dict, getattr(testclass, method), lose,
                     final_importants)
    assert meta_dict == result_dict