Mercurial > hg
comparison tests/test-util.py @ 38812:9d49bb117dde
util: make new timedcmstats class Python 3 compatible
author | Martijn Pieters <mj@zopatista.com> |
---|---|
date | Thu, 02 Aug 2018 20:53:03 +0100 |
parents | 8751d1e2a7ff |
children | 331ab85e910b |
comparison
equal
deleted
inserted
replaced
38811:64535d43c103 | 38812:9d49bb117dde |
---|---|
68 | 68 |
69 class timedtests(unittest.TestCase): | 69 class timedtests(unittest.TestCase): |
70 def testtimedcmstatsstr(self): | 70 def testtimedcmstatsstr(self): |
71 stats = util.timedcmstats() | 71 stats = util.timedcmstats() |
72 self.assertEqual(str(stats), '<unknown>') | 72 self.assertEqual(str(stats), '<unknown>') |
73 self.assertEqual(bytes(stats), b'<unknown>') | |
73 stats.elapsed = 12.34 | 74 stats.elapsed = 12.34 |
74 self.assertEqual(str(stats), util.timecount(12.34)) | 75 self.assertEqual(str(stats), pycompat.sysstr(util.timecount(12.34))) |
76 self.assertEqual(bytes(stats), util.timecount(12.34)) | |
75 | 77 |
76 def testtimedcmcleanexit(self): | 78 def testtimedcmcleanexit(self): |
77 # timestamps 1, 4, elapsed time of 4 - 1 = 3 | 79 # timestamps 1, 4, elapsed time of 4 - 1 = 3 |
78 with mocktimer([1, 3], _start_default): | 80 with mocktimer([1, 3], _start_default): |
79 with util.timedcm() as stats: | 81 with util.timedcm() as stats: |