Skip to content

Commit

Permalink
Add docstrings for tests.utils.* (#23, #27)
Browse files Browse the repository at this point in the history
  • Loading branch information
a5kin committed Dec 8, 2017
1 parent a826c24 commit 090fa7b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Tests for ``xentica.utils`` module."""
6 changes: 6 additions & 0 deletions tests/utils/test_formatters.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
"""Tests for ``xentica.utils.formatters`` module."""
import unittest

from xentica.utils.formatters import sizeof_fmt


class TestSizeFormatter(unittest.TestCase):
"""Tests for size formatter helper."""

def test_less_kilo(self):
"""Test less than Kilo rendering as plain values."""
val = sizeof_fmt(345)
self.assertEqual(val, "345", "Less Kilo format is incorrect.")

def test_kilo(self):
"""Test numbers between 10e3 and 10e6 has K postix."""
val = sizeof_fmt(34567)
self.assertEqual(val, "34.57K", "Kilo format is incorrect.")

def test_peta(self):
"""Test numbers between 10e15 and 10e18 has P postix."""
val = sizeof_fmt(34567 * (10 ** 12))
self.assertEqual(val, "34.57P", "Peta format is incorrect.")

def test_yokta(self):
"""Test numbers larger than 10e24 has Y postix."""
val = sizeof_fmt(34567 * (10 ** 21))
self.assertEqual(val, "34.57Y", "Yokta format is incorrect.")

0 comments on commit 090fa7b

Please sign in to comment.