Skip to content

Commit e21737d

Browse files
committed
update setup + raise more errors on api object
1 parent 9b0ac40 commit e21737d

File tree

6 files changed

+14
-7
lines changed

6 files changed

+14
-7
lines changed
173 Bytes
Binary file not shown.

onepyece/interface.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@ def __iter__(self):
2828
raise TypeError(f"Object of type {type(self)} is not iterable")
2929

3030
def __getitem__(self, item):
31-
return self.results[item]
31+
if getattr(self, "results", None) is not None:
32+
return self.results[item]
33+
raise TypeError(f"Object of type {type(self)} has no __getitem__ for unique result")
3234

3335
def __len__(self):
34-
return self.count if getattr(self, "count", None) is not None else 0
36+
if getattr(self, "count", None) is not None:
37+
return self.count
38+
raise TypeError(f"Object of type {type(self)} has no len() for unique result")
3539

3640
def load(self):
3741
api_data = get_data(self.url)

setup.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@
1313
long_description_content_type="text/markdown",
1414
url="https://github.com/icepick4/onepyece",
1515
classifiers=[
16-
"Programming Language :: Python :: 3",
16+
"Programming Language :: Python :: 3 :: Only",
17+
"Programming Language :: Python :: 3.8",
18+
"Programming Language :: Python :: 3.9",
19+
"Programming Language :: Python :: 3.10"
1720
"License :: OSI Approved :: MIT License",
1821
"Operating System :: OS Independent",
1922
],
2023
packages=["onepyece"],
21-
python_requires=">=3.6",
24+
python_requires=">=3.8",
2225
install_requires=["requests"],
2326
)

tests/__main__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import unittest
22

3-
# from .test_api import *
4-
# from .test_common import *
5-
# from .test_functions import *
3+
from .test_api import *
4+
from .test_common import *
5+
from .test_functions import *
66
from .test_interface import *
77

88
if __name__ == '__main__':
69 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)