Skip to content

Commit

Permalink
cubestat: more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
okuvshynov committed Aug 3, 2024
1 parent 320591d commit cc7aefe
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions cubestat/tests/test_format_measurement.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from cubestat.common import format_measurement

import unittest


class TestFormatMeasurement(unittest.TestCase):

def test_small_measurement(self):
buckets = [(1024 ** 2, 'MB'), (1024, 'KB'), (1, 'Bytes')]
curr = 15
mx = 25
self.assertEqual(format_measurement(curr, mx, buckets), ' 15 Bytes')

def test_avg_measurement(self):
buckets = [(1024 ** 2, 'MB'), (1024, 'KB'), (1, 'Bytes')]
curr = 1500
mx = 2050
self.assertEqual(format_measurement(curr, mx, buckets), ' 1 KB')


if __name__ == '__main__':
unittest.main()

0 comments on commit cc7aefe

Please sign in to comment.