Example #1
0
    def test_cli_stdin(self):
        stdin = StringIO(u'hello 1\nhello 2\nhello 3\n')
        stdout = StringIO()
        delta.real_cli(
            stdin=stdin,
            stdout=stdout,
            cmd=None,
            timestamps=False,
            interval=5,
            flex=True,
            separators=False,
            color=False,
            orig=False,
            skip_zeros=False,
            absolute=False,
            count=None)
        self.assertEqual(stdout.getvalue(), u'''hello  1
hello +1
hello +1
''')
Example #2
0
    def test_cli_cmd(self):
        stdout = StringIO()
        delta.real_cli(
            stdin=StringIO(),
            stdout=stdout,
            cmd=('echo "hello 1"',),
            timestamps=False,
            interval=0.1,
            flex=True,
            separators=False,
            color=False,
            orig=False,
            skip_zeros=False,
            absolute=False,
            count=5)

        self.assertEqual(stdout.getvalue(), u'''hello  1
hello +0
hello +0
hello +0
hello +0
''')