コード例 #1
0
def test_quotes_string_to_assign():
    assert replace("a.c = 1", "a.c", "2") == "a.c = 2"
    with pytest.raises(ValueError):
        replace("abc = 1", "a.c", "2")
コード例 #2
0
def test_update_without_spaces():
    assert replace("a=1", "a", "2") == "a=2"
コード例 #3
0
def test_update_in_middle():
    assert replace("a = 1\nb=2\nc = 3", "b", "4") == "a = 1\nb=4\nc = 3"
コード例 #4
0
def test_missing_is_error():
    with pytest.raises(ValueError):
        replace('', 'a', '1')
コード例 #5
0
def test_update_single_line():
    assert replace("a = 1", "a", "2") == "a = 2"
コード例 #6
0
def test_update_without_spaces():
    assert replace("a=1", "a", "2") == "a=2"
コード例 #7
0
def test_duplicates_are_errors():
    with pytest.raises(ValueError):
        replace('a = 1\na=1', 'a', '2')
コード例 #8
0
def test_update_without_spaces():
    assert replace('a=1', 'a', '2') == 'a=2'
コード例 #9
0
def test_update_in_middle():
    assert replace('a = 1\nb=2\nc = 3', 'b', '4') == 'a = 1\nb=4\nc = 3'
コード例 #10
0
def test_missing_is_error():
    with pytest.raises(ValueError):
        replace("", "a", "1")
コード例 #11
0
def test_update_single_line():
    assert replace('a = 1', 'a', '2') == 'a = 2'
コード例 #12
0
def test_duplicates_are_errors():
    with pytest.raises(ValueError):
        replace("a = 1\na=1", "a", "2")
コード例 #13
0
def test_quotes_string_to_assign():
    assert replace("a.c = 1", "a.c", "2") == "a.c = 2"
    with pytest.raises(ValueError):
        replace("abc = 1", "a.c", "2")
コード例 #14
0
def test_update_in_middle():
    assert replace("a = 1\nb=2\nc = 3", "b", "4") == "a = 1\nb=4\nc = 3"
コード例 #15
0
def test_duplicates_are_errors():
    with pytest.raises(ValueError):
        replace("a = 1\na=1", "a", "2")
コード例 #16
0
def test_quotes_string_to_assign():
    assert replace('a.c = 1', 'a.c', '2') == 'a.c = 2'
    with pytest.raises(ValueError):
        replace('abc = 1', 'a.c', '2')
コード例 #17
0
def test_missing_is_error():
    with pytest.raises(ValueError):
        replace("", "a", "1")
コード例 #18
0
def test_update_single_line():
    assert replace("a = 1", "a", "2") == "a = 2"