diff --git a/tests/test_download.py b/tests/test_download.py index 117add5..06910e9 100644 --- a/tests/test_download.py +++ b/tests/test_download.py @@ -1,6 +1,6 @@ # download.py -import Image +from PIL import Image from pyhelpers.dir import cd from pyhelpers.download import download @@ -9,5 +9,8 @@ path_to_python_logo = cd("tests", "picture", "python-logo.png") download(url, path_to_python_logo) +path_to_python_logo = "python-logo.png" +download(url, path_to_python_logo) + image = Image.open(path_to_python_logo) image.show() diff --git a/tests/test_misc.py b/tests/test_ops.py similarity index 66% rename from tests/test_misc.py rename to tests/test_ops.py index aaff6ad..95d5cf7 100644 --- a/tests/test_misc.py +++ b/tests/test_ops.py @@ -1,5 +1,5 @@ # misc.py -from pyhelpers.misc import confirmed +from pyhelpers.ops import confirmed confirmed(prompt="Continue?...", confirmation_required=True) diff --git a/tests/test_store.py b/tests/test_store.py index 5e40ad1..4de791a 100644 --- a/tests/test_store.py +++ b/tests/test_store.py @@ -4,7 +4,7 @@ import pandas as pd from pyhelpers.dir import cd -from pyhelpers.store import load_pickle, save_pickle +from pyhelpers.store import load_feather, load_pickle, save_feather, save_pickle xy_array = np.array([(530034, 180381), # London (406689, 286822), # Birmingham @@ -13,8 +13,15 @@ dat = pd.DataFrame(xy_array, columns=['Easting', 'Northing']) path_to_test_pickle = cd("tests", "data", "dat.pickle") # cd("tests\\data\\dat.pickle") -print(path_to_test_pickle) +print(path_to_test_pickle) # >>> C:\Users\fuq\DataShare\Experiments\pyhelpers\tests\data\dat.pickle -save_pickle(dat, path_to_test_pickle) +# Save dat as a pickle file +save_pickle(dat, path_to_test_pickle, verbose=True) dat_retrieved = load_pickle(path_to_test_pickle) print(dat_retrieved.equals(dat)) # should return True + +# Save dat as a feather file +path_to_test_feather = path_to_test_pickle.replace(".pickle", ".feather") +save_feather(dat, path_to_test_feather, verbose=True) +dat_retrieved = load_feather(path_to_test_feather) +print(dat_retrieved.equals(dat)) # should return True