Exemple #1
0
def test_successful_merge():
    old = '''
AAA 001
AAA 002
AAA 003
AAA 004'''

    other = '''
AAA 001
AAA 002
AAA 003
AAA 004'''

    new = '''
AAA 001
AAA 002
AAA 003
AAA 005'''

    expected = '''
AAA 001
AAA 002
AAA 003
AAA 005'''

    eq_(merge(old, other, new), expected)
Exemple #2
0
def test_successful_merge():
    old = '''
AAA 001
AAA 002
AAA 003
AAA 004'''

    other = '''
AAA 001
AAA 002
AAA 003
AAA 004'''

    new = '''
AAA 001
AAA 002
AAA 003
AAA 005'''

    expected = '''
AAA 001
AAA 002
AAA 003
AAA 005'''

    eq_(merge(old, other, new), expected)
Exemple #3
0
def test_new_and_other_changed():
    old = 'AAA 001\nAAA 001'
    other = 'AAA 001\nAAA 002'
    new = 'AAA 002'
    expected = '''<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
AAA 001
AAA 002
========================================
AAA 002
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'''
    eq_(merge(old, other, new), expected)
Exemple #4
0
def test_new_and_other_changed():
    old = 'AAA 001\nAAA 001'
    other = 'AAA 001\nAAA 002'
    new = 'AAA 002'
    expected = '''<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
AAA 001
AAA 002
========================================
AAA 002
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'''
    eq_(merge(old, other, new), expected)
Exemple #5
0
def test_convert_old_new_to_list():
    # the arguments for old, other and new can be lists of lines too.
    old = ('AAA 001',)
    other = ('AAA 002',)
    new = ('AAA 001',)
    expected = '''<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
AAA 002
========================================
AAA 001
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'''
    eq_(merge(old, other, new), expected)
Exemple #6
0
def test_convert_old_new_to_list():
    # the arguments for old, other and new can be lists of lines too.
    old = ('AAA 001', )
    other = ('AAA 002', )
    new = ('AAA 001', )
    expected = '''<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
AAA 002
========================================
AAA 001
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'''
    eq_(merge(old, other, new), expected)
Exemple #7
0
def test_other_and_new_changed():
    old = 'AAA 001\nAAA 002'
    other = 'AAA 002\nAAA 001'
    new = 'B2\nB52'
    expected = '''<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
AAA 002
AAA 001
========================================
B2
B52
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'''
    eq_(merge(old, other, new), expected)
Exemple #8
0
def test_only_two_changed():
    old = 'AAA 001\nAAA 002'
    other = 'AAA 001\nAAA 001\nAAA 002'
    new = 'AAA 001\nAAA 002'
    expected = '''AAA 001
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
AAA 001
AAA 002
========================================
AAA 002
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'''
    eq_(merge(old, other, new), expected)
Exemple #9
0
def test_other_and_new_changed():
    old = 'AAA 001\nAAA 002'
    other = 'AAA 002\nAAA 001'
    new = 'B2\nB52'
    expected = '''<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
AAA 002
AAA 001
========================================
B2
B52
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'''
    eq_(merge(old, other, new), expected)
Exemple #10
0
def test_only_two_changed():
    old = 'AAA 001\nAAA 002'
    other = 'AAA 001\nAAA 001\nAAA 002'
    new = 'AAA 001\nAAA 002'
    expected = '''AAA 001
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
AAA 001
AAA 002
========================================
AAA 002
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'''
    eq_(merge(old, other, new), expected)
Exemple #11
0
def test_new_added_lines():
    old = 'AAA 002'
    other = 'AAA 002'
    new = 'Cool New\nFeature\nAAA 02'
    expected = 'Cool New\nFeature\nAAA 02'
    eq_(merge(old, other, new), expected)
Exemple #12
0
def test_nochange():
    other = new = old = 'AAA 002\nAAA04'
    expected = 'AAA 002\nAAA04'
    eq_(merge(old, other, new), expected)
Exemple #13
0
def test_new_changed_other_unchanged():
    old = 'AAA 001\nAAA 002'
    other = 'AAA 001\nAAA 002'
    new = 'AAA 002'
    expected = 'AAA 002'
    eq_(merge(old, other, new), expected)
Exemple #14
0
def test_merge():
    old = """AAA 001
AAA 002
AAA 003
AAA 004
AAA 005
AAA 006
AAA 007
AAA 008
AAA 009
AAA 010
AAA 011
AAA 012
AAA 013
AAA 014
"""

    other = """AAA 001
AAA 002
AAA 005
AAA 006
AAA 007
AAA 008
BBB 001
BBB 002
AAA 009
AAA 010
BBB 003
"""

    new = """AAA 001
AAA 002
AAA 003
AAA 004
AAA 005
AAA 006
AAA 007
AAA 008
CCC 001
CCC 002
CCC 003
AAA 012
AAA 013
AAA 014
"""
    result = merge(old, other, new)

    expected = """AAA 001
AAA 002
AAA 005
AAA 006
AAA 007
AAA 008
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
BBB 001
BBB 002
AAA 009
AAA 010
BBB 003
========================================
CCC 001
CCC 002
CCC 003
AAA 012
AAA 013
AAA 014
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"""
    eq_(result, expected)
Exemple #15
0
def test_merge():
    old = """AAA 001
AAA 002
AAA 003
AAA 004
AAA 005
AAA 006
AAA 007
AAA 008
AAA 009
AAA 010
AAA 011
AAA 012
AAA 013
AAA 014
"""

    other = """AAA 001
AAA 002
AAA 005
AAA 006
AAA 007
AAA 008
BBB 001
BBB 002
AAA 009
AAA 010
BBB 003
"""

    new = """AAA 001
AAA 002
AAA 003
AAA 004
AAA 005
AAA 006
AAA 007
AAA 008
CCC 001
CCC 002
CCC 003
AAA 012
AAA 013
AAA 014
"""
    result = merge(old, other, new)

    expected = """AAA 001
AAA 002
AAA 005
AAA 006
AAA 007
AAA 008
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
BBB 001
BBB 002
AAA 009
AAA 010
BBB 003
========================================
CCC 001
CCC 002
CCC 003
AAA 012
AAA 013
AAA 014
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"""
    eq_(result, expected)
Exemple #16
0
def test_new_added_lines():
    old = 'AAA 002'
    other = 'AAA 002'
    new = 'Cool New\nFeature\nAAA 02'
    expected = 'Cool New\nFeature\nAAA 02'
    eq_(merge(old, other, new), expected)
Exemple #17
0
def test_nochange():
    other = new = old = 'AAA 002\nAAA04'
    expected = 'AAA 002\nAAA04'
    eq_(merge(old, other, new), expected)
Exemple #18
0
def test_new_changed_other_unchanged():
    old = 'AAA 001\nAAA 002'
    other = 'AAA 001\nAAA 002'
    new = 'AAA 002'
    expected = 'AAA 002'
    eq_(merge(old, other, new), expected)