Esempio n. 1
0
def test_assess_preformance():
    poor = p.analyze('..//data//exercise.csv', 'Street')
    good = g.analyze('..//data//exercise.csv', 'Street')
    poor_elapsed = poor[1] - poor[0]
    good_elapsed = good[1] - good[0]
    assert good_elapsed < poor_elapsed
    assert poor[2] == good[2]
    assert poor[3] == good[3]
Esempio n. 2
0
def test_assess_preformance():
    """ compare """
    poor = p.analyze('exercise.csv')
    good = g.analyze('exercise.csv')
    poor_elapsed = poor[1] - poor[0]
    good_elapsed = good[1] - good[0]
    assert good_elapsed < poor_elapsed
    assert poor[2] == good[2]
    assert poor[3] == good[3]
Esempio n. 3
0
    def test_analyze(self):#, datetime_good, datetime_poor):
        """Tests ``analyze``."""

        # datetime_good.now.return_value = NOW
        # datetime_poor.now.return_value = NOW

        with mock.patch("poor_perf.datetime") as mock_date:
            mock_date.datetime.now.return_value = NOW
            mock_date.datetime.side_effect = lambda *args, **kwargs: dt(*args, **kwargs)
            mock_date.datetime.strptime = lambda *args, **kwargs: dt.strptime(*args, **kwargs)
            with mock.patch("builtins.print") as mock_print:
                poor_res = poor.analyze(FILE)
                poor_print = mock_print.call_args_list

        with mock.patch("good_perf.datetime") as mock_date:
            mock_date.datetime.now.return_value = NOW
            mock_date.datetime.side_effect = lambda *args, **kwargs: dt(*args, **kwargs)
            mock_date.datetime.strptime = lambda *args, **kwargs: dt.strptime(*args, **kwargs)
            with mock.patch("builtins.print") as mock_print:
                good_res = good.analyze(FILE)
                good_print = mock_print.call_args_list

        self.assertEqual(poor_print, good_print)
        self.assertEqual(poor_res, good_res)