Exemplo n.º 1
0
def Number_lines_are_printed_without_quotes__test():
    out = StringIO()
    csv = Csv( out, ( "a", "b", "c" ) )
    csv.line( ( 2, "x", 3.5 ) )
    assert_equal(
        '''"a", "b", "c"
2, "x", 3.5
''',
        out.getvalue()
    )
Exemplo n.º 2
0
def String_lines_are_printed_in_quotes__test():
    out = StringIO()
    csv = Csv( out, ( "a", "b" ) )
    csv.line( ( "x", "y" ) )
    assert_equal(
        '''"a", "b"
"x", "y"
''',
        out.getvalue()
    )
Exemplo n.º 3
0
def Number_lines_are_printed_without_quotes__test():
    out = StringIO()
    csv = Csv(out, ("a", "b", "c"))
    csv.line((2, "x", 3.5))
    assert_equal(
        """"a", "b", "c"
2, "x", 3.5
""",
        out.getvalue(),
    )
Exemplo n.º 4
0
def String_lines_are_printed_in_quotes__test():
    out = StringIO()
    csv = Csv(out, ("a", "b"))
    csv.line(("x", "y"))
    assert_equal(
        """"a", "b"
"x", "y"
""",
        out.getvalue(),
    )
Exemplo n.º 5
0
def Multiple_lines_are_printed__test():
    out = StringIO()
    csv = Csv( out, ( "a", "b", "c" ) )
    csv.line( ( 2, "x", 3.5 ) )
    csv.line( ( 4, "y", 5.5 ) )
    assert_equal(
        '''"a", "b", "c"
2, "x", 3.5
4, "y", 5.5
''',
        out.getvalue()
    )
Exemplo n.º 6
0
def Multiple_lines_are_printed__test():
    out = StringIO()
    csv = Csv(out, ("a", "b", "c"))
    csv.line((2, "x", 3.5))
    csv.line((4, "y", 5.5))
    assert_equal(
        """"a", "b", "c"
2, "x", 3.5
4, "y", 5.5
""",
        out.getvalue(),
    )
Exemplo n.º 7
0
def Headings_are_printed_quoted__test():
    out = StringIO()
    csv = Csv( out, ( "a", "B c" ) )
    csv # Silence lint
    assert_equal(
        '''"a", "B c"
''',
        out.getvalue()
    )
Exemplo n.º 8
0
def main( argv, out, err ):
    try:
        git = Git( RawGit() )
        csv = Csv(
            out,
            ( "Commit", "Date", "Author", "Added", "Removed", "File" )
        )
        for cod in expand_lines( git, expand_authors( git.log() ) ):
            csv.line( (
                cod.commit_hash,
                cod.date.date().isoformat(),
                cod.author,
                cod.added,
                cod.removed,
                cod.filename,
            ) )
    except subprocess.CalledProcessError as e:
        print(str( e ))
        sys.exit( 1 )
    finally:
        out.flush()