Skip to content

Commit c5b6712

Browse files
moving test to avoid flake8 error
1 parent b107512 commit c5b6712

File tree

5 files changed

+16
-17
lines changed

5 files changed

+16
-17
lines changed

api/api.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
query_model = create_model("num", num=(int, ...))
1313
api_version = "0.2.3"
1414

15+
1516
@app.get("/")
1617
def index():
17-
return {"status": "200",
18-
"message": "Welcome to Random Profile Generator API",
18+
return {"status": "200",
19+
"message": "Welcome to Random Profile Generator API",
1920
"version": api_version}
2021

2122

@@ -28,10 +29,10 @@ async def multiple_profile(params: query_model = Depends()):
2829
"""
2930
params_as_dict = params.dict()
3031
if params_as_dict['num'] > 100:
31-
return {"status": "400",
32+
return {"status": "400",
3233
"message": "Number of profiles should be less than 100",
3334
"version": api_version}
34-
35+
3536
num = params_as_dict['num']
3637
profile = rp.full_profile(num)
3738
return profile
@@ -47,10 +48,10 @@ async def multiple_first_name(params: query_model = Depends()):
4748
"""
4849
params_as_dict = params.dict()
4950
if params_as_dict['num'] > 100:
50-
return {"status": "400",
51+
return {"status": "400",
5152
"message": "Number of profiles should be less than 100",
5253
"version": api_version}
53-
54+
5455
num = params_as_dict['num']
5556
first_names = rp.first_name(num)
5657
return first_names
@@ -66,10 +67,10 @@ async def multiple_last_name(params: query_model = Depends()):
6667
"""
6768
params_as_dict = params.dict()
6869
if params_as_dict['num'] > 100:
69-
return {"status": "400",
70+
return {"status": "400",
7071
"message": "Number of profiles should be less than 100",
7172
"version": api_version}
72-
73+
7374
num = params_as_dict['num']
7475
last_names = rp.last_name(num)
7576
return last_names
@@ -85,10 +86,10 @@ async def multiple_full_name(params: query_model = Depends()):
8586
"""
8687
params_as_dict = params.dict()
8788
if params_as_dict['num'] > 100:
88-
return {"status": "400",
89+
return {"status": "400",
8990
"message": "Number of profiles should be less than 100",
9091
"version": api_version}
91-
92+
9293
num = params_as_dict['num']
9394

9495
full_names = rp.full_name(num)

random_profile/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
from random_profile.main import RandomProfile
2+
3+
__all__ = ["RandomProfile"]

random_profile/main.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
from random_profile.utils import load_txt_file
1414
from random_profile.utils import generate_dob_age
1515
from random_profile.utils import generate_random_height_weight
16-
from random_profile.utils import ROOT_DIR
17-
18-
ASSETS_DIR = os.path.join(ROOT_DIR, "random_profile", "assets")
16+
from random_profile.utils import ASSETS_DIR
1917

2018
fname_txt = os.path.join(ASSETS_DIR, "fnames.txt")
2119
lname_txt = os.path.join(ASSETS_DIR, "lnames.txt")

tests/test_package.py renamed to random_profile/test_package.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import unittest
2-
from random_profile import RandomProfile
3-
4-
import sys
5-
sys.path.append('.')
62

3+
from random_profile import RandomProfile
74
random_profile = RandomProfile(num=1)
85

96

random_profile/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import logging
55

66
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
7+
ASSETS_DIR = os.path.join(ROOT_DIR, "random_profile", "assets")
78
logging.basicConfig(filename='log/example.log', encoding='utf-8', level=logging.DEBUG)
89

910

0 commit comments

Comments
 (0)