Ejemplo n.º 1
0
def test_combining_with_none():
    DATA_INT = {'key_int': 0}

    command1 = Command('method', 'path', DATA_INT)
    combined = command1 + None

    assert combined._data == DATA_INT

    # Combining should mutate the original command
    command1.combine_data(None)
    assert command1._data == DATA_INT
Ejemplo n.º 2
0
def test_combining_with_none():
    DATA_INT = {"key_int": 0}

    command1 = Command("method", "path", DATA_INT)
    combined = command1 + None

    assert combined._data == DATA_INT

    # Combining should mutate the original command
    command1.combine_data(None)
    assert command1._data == DATA_INT
Ejemplo n.º 3
0
def test_combining_mutates():
    DATA_INT = {'key_int': 0}
    DATA_INT2 = {'key_int_2': 1}
    COMBINED_INT = {'key_int': 0, 'key_int_2': 1}

    command1 = Command('method', 'path', DATA_INT)
    command2 = Command('method', 'path', DATA_INT2)
    combined = command1 + command2

    # Adding shouldn't mutate the original commands
    assert command1._data == DATA_INT
    assert command2._data == DATA_INT2
    assert combined._data == COMBINED_INT

    # Combining should mutate the original command
    command1.combine_data(command2)
    assert command1._data == COMBINED_INT
    assert command2._data == DATA_INT2
Ejemplo n.º 4
0
def test_combining_mutates():
    DATA_INT = {"key_int": 0}
    DATA_INT2 = {"key_int_2": 1}
    COMBINED_INT = {"key_int": 0, "key_int_2": 1}

    command1 = Command("method", "path", DATA_INT)
    command2 = Command("method", "path", DATA_INT2)
    combined = command1 + command2

    # Adding shouldn't mutate the original commands
    assert command1._data == DATA_INT
    assert command2._data == DATA_INT2
    assert combined._data == COMBINED_INT

    # Combining should mutate the original command
    command1.combine_data(command2)
    assert command1._data == COMBINED_INT
    assert command2._data == DATA_INT2