Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Unified Diff: gslib/tests/test_util.py

Issue 698893003: Update checked in version of gsutil to version 4.6 (Closed) Base URL: http://dart.googlecode.com/svn/third_party/gsutil/
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gslib/tests/test_update.py ('k') | gslib/tests/test_versioning.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gslib/tests/test_util.py
===================================================================
--- gslib/tests/test_util.py (revision 33376)
+++ gslib/tests/test_util.py (working copy)
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
@@ -18,18 +19,20 @@
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
-
"""Tests for gsutil utility functions."""
+from __future__ import absolute_import
+
from gslib import util
+import gslib.tests.testcase as testcase
from gslib.util import CompareVersions
-import gslib.tests.testcase as testcase
class TestUtil(testcase.GsUtilUnitTestCase):
"""Tests for utility functions."""
def test_MakeHumanReadable(self):
+ """Tests converting byte counts to human-readable strings."""
self.assertEqual(util.MakeHumanReadable(0), '0 B')
self.assertEqual(util.MakeHumanReadable(1023), '1023 B')
self.assertEqual(util.MakeHumanReadable(1024), '1 KB')
@@ -41,6 +44,7 @@
self.assertEqual(util.MakeHumanReadable(1024 ** 6), '1 EB')
def test_MakeBitsHumanReadable(self):
+ """Tests converting bit counts to human-readable strings."""
self.assertEqual(util.MakeBitsHumanReadable(0), '0 bit')
self.assertEqual(util.MakeBitsHumanReadable(1023), '1023 bit')
self.assertEqual(util.MakeBitsHumanReadable(1024), '1 Kbit')
@@ -52,6 +56,7 @@
self.assertEqual(util.MakeBitsHumanReadable(1024 ** 6), '1 Ebit')
def test_HumanReadableToBytes(self):
+ """Tests converting human-readable strings to byte counts."""
self.assertEqual(util.HumanReadableToBytes('1'), 1)
self.assertEqual(util.HumanReadableToBytes('15'), 15)
self.assertEqual(util.HumanReadableToBytes('15.3'), 15)
@@ -67,6 +72,7 @@
self.assertEqual(util.HumanReadableToBytes('1e'), 1024 ** 6)
def test_CompareVersions(self):
+ """Tests CompareVersions for various use cases."""
# CompareVersions(first, second) returns (g, m), where
# g is True if first known to be greater than second, else False.
# m is True if first known to be greater by at least 1 major version,
« no previous file with comments | « gslib/tests/test_update.py ('k') | gslib/tests/test_versioning.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698