summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorAnca Iordache <aiordache@users.noreply.github.com>2020-08-17 18:32:48 +0200
committerGitHub <noreply@github.com>2020-08-17 18:32:48 +0200
commit2c522fb362247a692c0493f0b47a33988eb2f3e3 (patch)
treea71373e39c3c1e422029347af18eb67def7d11f1 /tests/unit
parent30ff9f339cfb15ea00d0c6b1b3b675de3c80e8dd (diff)
downloaddocker-py-2c522fb362247a692c0493f0b47a33988eb2f3e3.tar.gz
Fix memory conversion to bytes (#2645)
* Fix memory conversion to bytes Co-authored-by: Ulysses Souza <ulysses.souza@gmail.com> Signed-off-by: aiordache <anca.iordache@docker.com>
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/utils_test.py24
1 files changed, 7 insertions, 17 deletions
diff --git a/tests/unit/utils_test.py b/tests/unit/utils_test.py
index d9cb002..07209a1 100644
--- a/tests/unit/utils_test.py
+++ b/tests/unit/utils_test.py
@@ -5,27 +5,21 @@ import json
import os
import os.path
import shutil
-import sys
import tempfile
import unittest
-
+import pytest
+import six
from docker.api.client import APIClient
from docker.constants import IS_WINDOWS_PLATFORM
from docker.errors import DockerException
-from docker.utils import (
- convert_filters, convert_volume_binds, decode_json_header, kwargs_from_env,
- parse_bytes, parse_devices, parse_env_file, parse_host,
- parse_repository_tag, split_command, update_headers,
-)
-
+from docker.utils import (convert_filters, convert_volume_binds,
+ decode_json_header, kwargs_from_env, parse_bytes,
+ parse_devices, parse_env_file, parse_host,
+ parse_repository_tag, split_command, update_headers)
from docker.utils.ports import build_port_bindings, split_port
from docker.utils.utils import format_environment
-import pytest
-
-import six
-
TEST_CERT_DIR = os.path.join(
os.path.dirname(__file__),
'testdata/certs',
@@ -447,11 +441,7 @@ class ParseBytesTest(unittest.TestCase):
parse_bytes("127.0.0.1K")
def test_parse_bytes_float(self):
- with pytest.raises(DockerException):
- parse_bytes("1.5k")
-
- def test_parse_bytes_maxint(self):
- assert parse_bytes("{0}k".format(sys.maxsize)) == sys.maxsize * 1024
+ assert parse_bytes("1.5k") == 1536
class UtilsTest(unittest.TestCase):