Skip to content

Commit af8c137

Browse files
committed
change import: cmn to icom
1 parent e3a0f56 commit af8c137

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

pandas/tests/io/test_common.py

+19-19
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pytest
77

88
import pandas as pd
9-
import pandas.io.common as cmn
9+
import pandas.io.common as icom
1010
import pandas.util._test_decorators as td
1111
import pandas.util.testing as tm
1212
from pandas.compat import (
@@ -55,36 +55,36 @@ class TestCommonIOCapabilities(object):
5555

5656
def test_expand_user(self):
5757
filename = '~/sometest'
58-
expanded_name = cmn._expand_user(filename)
58+
expanded_name = icom._expand_user(filename)
5959

6060
assert expanded_name != filename
6161
assert os.path.isabs(expanded_name)
6262
assert os.path.expanduser(filename) == expanded_name
6363

6464
def test_expand_user_normal_path(self):
6565
filename = '/somefolder/sometest'
66-
expanded_name = cmn._expand_user(filename)
66+
expanded_name = icom._expand_user(filename)
6767

6868
assert expanded_name == filename
6969
assert os.path.expanduser(filename) == expanded_name
7070

7171
@td.skip_if_no('pathlib')
7272
def test_stringify_path_pathlib(self):
73-
rel_path = cmn._stringify_path(Path('.'))
73+
rel_path = icom._stringify_path(Path('.'))
7474
assert rel_path == '.'
75-
redundant_path = cmn._stringify_path(Path('foo//bar'))
75+
redundant_path = icom._stringify_path(Path('foo//bar'))
7676
assert redundant_path == os.path.join('foo', 'bar')
7777

7878
@td.skip_if_no('py.path')
7979
def test_stringify_path_localpath(self):
8080
path = os.path.join('foo', 'bar')
8181
abs_path = os.path.abspath(path)
8282
lpath = LocalPath(path)
83-
assert cmn._stringify_path(lpath) == abs_path
83+
assert icom._stringify_path(lpath) == abs_path
8484

8585
def test_stringify_path_fspath(self):
8686
p = CustomFSPath('foo/bar.csv')
87-
result = cmn._stringify_path(p)
87+
result = icom._stringify_path(p)
8888
assert result == 'foo/bar.csv'
8989

9090
@pytest.mark.parametrize('extension,expected', [
@@ -97,12 +97,12 @@ def test_stringify_path_fspath(self):
9797
@pytest.mark.parametrize('path_type', path_types)
9898
def test_infer_compression_from_path(self, extension, expected, path_type):
9999
path = path_type('foo/bar.csv' + extension)
100-
compression = cmn._infer_compression(path, compression='infer')
100+
compression = icom._infer_compression(path, compression='infer')
101101
assert compression == expected
102102

103103
def test_get_filepath_or_buffer_with_path(self):
104104
filename = '~/sometest'
105-
filepath_or_buffer, _, _, should_close = cmn.get_filepath_or_buffer(
105+
filepath_or_buffer, _, _, should_close = icom.get_filepath_or_buffer(
106106
filename)
107107
assert filepath_or_buffer != filename
108108
assert os.path.isabs(filepath_or_buffer)
@@ -111,7 +111,7 @@ def test_get_filepath_or_buffer_with_path(self):
111111

112112
def test_get_filepath_or_buffer_with_buffer(self):
113113
input_buffer = StringIO()
114-
filepath_or_buffer, _, _, should_close = cmn.get_filepath_or_buffer(
114+
filepath_or_buffer, _, _, should_close = icom.get_filepath_or_buffer(
115115
input_buffer)
116116
assert filepath_or_buffer == input_buffer
117117
assert not should_close
@@ -246,18 +246,18 @@ def test_constructor_bad_file(self, mmap_file):
246246
msg = "[Errno 22]"
247247
err = mmap.error
248248

249-
tm.assert_raises_regex(err, msg, cmn.MMapWrapper, non_file)
249+
tm.assert_raises_regex(err, msg, icom.MMapWrapper, non_file)
250250

251251
target = open(mmap_file, 'r')
252252
target.close()
253253

254254
msg = "I/O operation on closed file"
255255
tm.assert_raises_regex(
256-
ValueError, msg, cmn.MMapWrapper, target)
256+
ValueError, msg, icom.MMapWrapper, target)
257257

258258
def test_get_attr(self, mmap_file):
259259
with open(mmap_file, 'r') as target:
260-
wrapper = cmn.MMapWrapper(target)
260+
wrapper = icom.MMapWrapper(target)
261261

262262
attrs = dir(wrapper.mmap)
263263
attrs = [attr for attr in attrs
@@ -271,7 +271,7 @@ def test_get_attr(self, mmap_file):
271271

272272
def test_next(self, mmap_file):
273273
with open(mmap_file, 'r') as target:
274-
wrapper = cmn.MMapWrapper(target)
274+
wrapper = icom.MMapWrapper(target)
275275
lines = target.readlines()
276276

277277
for line in lines:
@@ -313,14 +313,14 @@ def test_compression_size(obj, method, compression_only):
313313
def test_compression_size_fh(obj, method, compression_only):
314314

315315
with tm.ensure_clean() as path:
316-
f, handles = cmn._get_handle(path, 'w', compression=compression_only)
316+
f, handles = icom._get_handle(path, 'w', compression=compression_only)
317317
with f:
318318
getattr(obj, method)(f)
319319
assert not f.closed
320320
assert f.closed
321321
compressed = os.path.getsize(path)
322322
with tm.ensure_clean() as path:
323-
f, handles = cmn._get_handle(path, 'w', compression=None)
323+
f, handles = icom._get_handle(path, 'w', compression=None)
324324
with f:
325325
getattr(obj, method)(f)
326326
assert not f.closed
@@ -339,7 +339,7 @@ def test_dataframe_compression_defaults_to_infer(
339339
# Test that DataFrame.to_* methods default to inferring compression from
340340
# paths. GH 22004
341341
input = pd.DataFrame([[1.0, 0, -4], [3.4, 5, 2]], columns=['X', 'Y', 'Z'])
342-
extension = cmn._compression_to_extension[compression_only]
342+
extension = icom._compression_to_extension[compression_only]
343343
with tm.ensure_clean('compressed' + extension) as path:
344344
getattr(input, write_method)(path, **write_kwargs)
345345
output = read_method(path, compression=compression_only)
@@ -358,7 +358,7 @@ def test_series_compression_defaults_to_infer(
358358
# Test that Series.to_* methods default to inferring compression from
359359
# paths. GH 22004
360360
input = pd.Series([0, 5, -2, 10], name='X')
361-
extension = cmn._compression_to_extension[compression_only]
361+
extension = icom._compression_to_extension[compression_only]
362362
with tm.ensure_clean('compressed' + extension) as path:
363363
getattr(input, write_method)(path, **write_kwargs)
364364
output = read_method(path, compression=compression_only, **read_kwargs)
@@ -377,7 +377,7 @@ def test_compression_warning(compression_only):
377377
[12.32112, 123123.2, 321321.2]],
378378
columns=['X', 'Y', 'Z'])
379379
with tm.ensure_clean() as path:
380-
f, handles = cmn._get_handle(path, 'w', compression=compression_only)
380+
f, handles = icom._get_handle(path, 'w', compression=compression_only)
381381
with tm.assert_produces_warning(RuntimeWarning,
382382
check_stacklevel=False):
383383
with f:

0 commit comments

Comments
 (0)