コード例 #1
0
def test_format_time():
    with pytest.warns(FutureWarning, match="dask.utils.format_time") as record:
        assert format_time(1.4) == " 1.4s"
        assert format_time(10.4) == "10.4s"
        assert format_time(100.4) == " 1min 40.4s"
        assert format_time(1000.4) == "16min 40.4s"
        assert format_time(10000.4) == " 2hr 46min 40.4s"

    assert len(record) == 5  # Each `assert` above warns
コード例 #2
0
    def _draw_bar(self, frac, elapsed):
        start = self._start_percentage / 100

        frac += start - frac * start
        bar = "#" * int(self._width * frac)
        percent = int(100 * frac)
        elapsed = format_time(elapsed)
        msg = "[{0:<{1}}] | {2}% Done | {3}".format(bar, self._width, percent,
                                                    elapsed)

        self._logging_function(msg, percent)
コード例 #3
0
ファイル: test_progress.py プロジェクト: z7ye/dask-1
def test_format_time():
    assert format_time(1.4) == " 1.4s"
    assert format_time(10.4) == "10.4s"
    assert format_time(100.4) == " 1min 40.4s"
    assert format_time(1000.4) == "16min 40.4s"
    assert format_time(10000.4) == " 2hr 46min 40.4s"
コード例 #4
0
ファイル: test_progress.py プロジェクト: chrislaing/dask
def test_format_time():
    assert format_time(1.4) == ' 1.4s'
    assert format_time(10.4) == '10.4s'
    assert format_time(100.4) == ' 1min 40.4s'
    assert format_time(1000.4) == '16min 40.4s'
    assert format_time(10000.4) == ' 2hr 46min 40.4s'
コード例 #5
0
def test_format_time():
    assert format_time(1.4) == ' 1.4s'
    assert format_time(10.4) == '10.4s'
    assert format_time(100.4) == ' 1min 40.4s'
    assert format_time(1000.4) == '16min 40.4s'
    assert format_time(10000.4) == ' 2hr 46min 40.4s'
コード例 #6
0
ファイル: test_progress.py プロジェクト: roxyboy/dask
def test_format_time():
    assert format_time(1.4) == " 1.4s"
    assert format_time(10.4) == "10.4s"
    assert format_time(100.4) == " 1min 40.4s"
    assert format_time(1000.4) == "16min 40.4s"
    assert format_time(10000.4) == " 2hr 46min 40.4s"