コード例 #1
0
ファイル: test_source.py プロジェクト: rmfitzpatrick/pytest
def test_source_putaround():
    source = Source()
    source = source.putaround("""
        if 1:
            x=1
    """)
    assert str(source).strip() == "if 1:\n    x=1"
コード例 #2
0
def test_source_putaround():
    source = Source()
    source = source.putaround("""
        if 1:
            x=1
    """)
    assert str(source).strip() == "if 1:\n    x=1"
コード例 #3
0
ファイル: test_source.py プロジェクト: walterwsmf/pytest
def test_source_putaround_simple():
    source = Source("raise ValueError")
    source = source.putaround(
        "try:", """\
        except ValueError:
            x = 42
        else:
            x = 23""")
    assert str(source) == """\
コード例 #4
0
ファイル: test_source.py プロジェクト: rmfitzpatrick/pytest
def test_source_putaround_simple():
    source = Source("raise ValueError")
    source = source.putaround(
        "try:", """\
        except ValueError:
            x = 42
        else:
            x = 23""")
    assert str(source) == """\