Exemple #1
0
    def test_summary(self):
        items = range(100)
        out = StringIO()
        seq = st.seqtimer(items, output=out, summary=True)
        for (idx, item) in enumerate(seq):
            self.assertEqual(items[idx], item)

        self.assertTrue("Finished processing" in out.getvalue())
Exemple #2
0
 def test_warns(self):
     out = StringIO()
     seq = st.seqtimer(iter(range(10)), output=out, summary=False,
                       length=1)
     with patch_object(st.warnings, 'warn') as warn:
         for (idx, item) in enumerate(seq):
             pass
     self.assertTrue(warn.called)
Exemple #3
0
    def test_passthrough(self):
        items = range(100)
        out = StringIO()
        seq = st.seqtimer(items, items=10, output=out, summary=False)
        for (idx, item) in enumerate(seq):
            self.assertEqual(items[idx], item)

        self.assertEqual(len(out.getvalue().split("\n")), 11)