Beispiel #1
0
def test_basic():
    with shell.tempdir():
        stdin = """
        b,c,d
        e,f,g
        h,i,j
        """
        stdout = """
        prefix_02
        prefix_04
        prefix_05
        """
        assert rm_whitespace(unindent(stdout)) == shell.run(
            'bsv | bpartition -l 10 prefix', stdin=unindent(stdin))
        stdout = """
        prefix_02:h,i,j
        prefix_04:e,f,g
        prefix_05:b,c,d
        """
        assert unindent(stdout).strip() == shell.run('bcat -l -p prefix*')
        stdout = """
        prefix_02
        prefix_04
        prefix_05
        """
        assert unindent(stdout).strip() == shell.run('ls prefix*')
Beispiel #2
0
def test_appends():
    with shell.tempdir():
        stdin = """
        0,b,c,d
        1,e,f,g
        2,h,i,j
        """
        stdout = """
        prefix00
        prefix01
        prefix02
        """
        assert rm_whitespace(unindent(stdout)) == shell.run(f'bsv | bpartition 10 prefix', stdin=unindent(stdin))
        assert rm_whitespace(unindent(stdout)) == shell.run(f'bsv | bpartition 10 prefix', stdin=unindent(stdin))
        stdout = """
        prefix00:b,c,d
        prefix00:b,c,d
        prefix01:e,f,g
        prefix01:e,f,g
        prefix02:h,i,j
        prefix02:h,i,j
        """
        assert unindent(stdout).strip() == shell.run(f'bcat --prefix prefix*')
        stdout = """
        prefix00
        prefix01
        prefix02
        """
        assert unindent(stdout).strip() == shell.run('ls prefix*')
Beispiel #3
0
def test_without_prefix():
    with shell.tempdir():
        stdin = """
        b,c,d
        e,f,g
        h,i,j
        """
        stdout = """
        02
        04
        05
        """
        assert rm_whitespace(unindent(stdout)) == shell.run(
            'bsv | bpartition -l 10', stdin=unindent(stdin))
Beispiel #4
0
def test_basic():
    with shell.tempdir():
        shell.run('echo -e "a,a\nc,c\ne,e\n" | bsv > a.bsv')
        shell.run('echo -e "b,b\nd,d\nf,f\n" | bsv > b.bsv')
        stdout = """
        a,a
        b,b
        c,c
        d,d
        e,e
        f,f
        """
        assert rm_whitespace(unindent(stdout)) == shell.run(
            'echo a.bsv b.bsv | bmerge | csv', stream=True)
        assert rm_whitespace(unindent(stdout)) == shell.run(
            '(echo a.bsv; echo b.bsv) | bmerge | csv', stream=True)
        assert rm_whitespace(unindent(stdout)) == shell.run(
            '(echo a.bsv; echo; echo b.bsv) | bmerge | csv', stream=True)
Beispiel #5
0
def test_basic():
    with shell.tempdir():
        shell.run('for char in a a b b c c; do echo $char | bsv >> $char; done')
        stdout = """
        a:a
        b:b
        c:c
        """
        assert rm_whitespace(unindent(stdout)) == shell.run('bcat --prefix --head 1 a b c')
        stdout = """
        a:a
        a:a
        b:b
        b:b
        c:c
        c:c
        """
        assert rm_whitespace(unindent(stdout)) == shell.run('bcat --prefix --head 2 a b c')
        assert rm_whitespace(unindent(stdout)) == shell.run('bcat --head 2 --prefix a b c')
        assert rm_whitespace(unindent(stdout)) == shell.run('bcat --prefix a b c')
        stdout = """
        a
        b
        c
        """
        assert rm_whitespace(unindent(stdout)) == shell.run('bcat --head 1 a b c')
        stdout = """
        a
        a
        b
        b
        c
        c
        """
        assert rm_whitespace(unindent(stdout)) == shell.run('bcat a b c')