Skip to content

Commit ff447e2

Browse files
author
Marco Gorelli
committed
🎨 move imports to top
1 parent 57a396b commit ff447e2

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

pandas/tests/io/pytables/test_store.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from distutils.version import LooseVersion
44
from io import BytesIO
55
import os
6+
from pathlib import Path
67
import re
78
from warnings import catch_warnings, simplefilter
89

@@ -4597,8 +4598,6 @@ def test_read_nokey_empty(self, setup_path):
45974598
def test_read_from_pathlib_path(self, setup_path):
45984599

45994600
# GH11773
4600-
from pathlib import Path
4601-
46024601
expected = DataFrame(
46034602
np.random.rand(4, 5), index=list("abcd"), columns=list("ABCDE")
46044603
)

pandas/tests/io/sas/test_sas7bdat.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import io
22
import os
3+
from pathlib import Path
34

45
import numpy as np
56
import pytest
@@ -69,8 +70,6 @@ def test_from_iterator(self):
6970
rdr.close()
7071

7172
def test_path_pathlib(self):
72-
from pathlib import Path
73-
7473
for j in 0, 1:
7574
df0 = self.data[j]
7675
for k in self.test_ix[j]:

pandas/tests/io/test_common.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from io import StringIO
55
import mmap
66
import os
7+
from pathlib import Path
78

89
import pytest
910

@@ -27,14 +28,7 @@ def __fspath__(self):
2728

2829

2930
# Functions that consume a string path and return a string or path-like object
30-
path_types = [str, CustomFSPath]
31-
32-
try:
33-
from pathlib import Path
34-
35-
path_types.append(Path)
36-
except ImportError:
37-
pass
31+
path_types = [str, CustomFSPath, Path]
3832

3933
try:
4034
from py.path import local as LocalPath

0 commit comments

Comments
 (0)