diff --git a/python-package/itscalledsoccer/client.py b/python-package/itscalledsoccer/client.py index 42d3575..8cddb7d 100644 --- a/python-package/itscalledsoccer/client.py +++ b/python-package/itscalledsoccer/client.py @@ -234,6 +234,10 @@ def _execute_query( :param params: URL query strings :returns: Dataframe """ + for k, v in params.items(): + if isinstance(v, list): + params[k] = ",".join(v) + temp_response = self._single_request(url, params) response = temp_response diff --git a/python-package/setup.py b/python-package/setup.py index 335906d..06c90ef 100644 --- a/python-package/setup.py +++ b/python-package/setup.py @@ -6,7 +6,7 @@ setup( name="itscalledsoccer", packages=find_packages(exclude=["tests", "tests.*"]), - version="0.1.2", + version="0.1.3", description="Programmatically interact with the American Soccer Analysis API", long_description=long_description, long_description_content_type = "text/markdown", diff --git a/python-package/tests/features/entities.feature b/python-package/tests/features/entities.feature index 7a4b3fa..c906720 100644 --- a/python-package/tests/features/entities.feature +++ b/python-package/tests/features/entities.feature @@ -70,20 +70,20 @@ Feature: Entities functions @games Examples: - | entity | args | - | games | leagues=mls seasons=2020 | - | games | leagues=[mls,uslc] seasons=2020 | - | games | game_ids=9z5kdxgKqA | - | games | game_ids=[9z5kdxgKqA,9z5kAnbPQA] | - | games | team_ids=Vj58weDM8n | - | games | team_ids=[Vj58weDM8n,9Yqdwg85vJ] | - | games | team_names=Union | - | games | team_names=[Philadelphia,Portland] | - | games | leagues=mls game_ids=[9z5kdxgKqA,9z5kAnbPQA] | - | games | leagues=mls team_names=Philadelphia Union | - | games | seasons=2020 | - | games | seasons=[2020,2021] | - | games | stages=Playoffs | - | games | stages=[Playoffs,Regular Season] | + | entity | args | + | games | leagues=mls seasons=2020 | + | games | leagues=[mls,uslc] seasons=2020 | + | games | game_ids=9z5kdxgKqA | + | games | game_ids=[9z5kdxgKqA,9z5kAnbPQA] | + | games | team_ids=Vj58weDM8n | + | games | team_ids=[Vj58weDM8n,9Yqdwg85vJ] | + | games | team_names=Union | + | games | team_names=[Philadelphia,Portland] | + | games | leagues=mls game_ids=[9z5kdxgKqA,9z5kAnbPQA] | + | games | leagues=mls team_names=Philadelphia Union | + | games | seasons=2020 | + | games | seasons=[2020,2021] | + | games | stages=Playoffs | + | games | stages=[Playoffs,Regular Season] seasons=2021 | # TODO: Add expected failure scenarios diff --git a/python-package/tests/features/stats.feature b/python-package/tests/features/stats.feature index 04450a0..05d65cd 100644 --- a/python-package/tests/features/stats.feature +++ b/python-package/tests/features/stats.feature @@ -119,7 +119,7 @@ Feature: Stats functions | player | split_by_seasons=true season_name=[2015,2016] | goals_added | | player | split_by_games=true season_name=2020 general_position=CB | goals_added | | player | stage_name=Playoffs | goals_added | - | player | stage_name=[Playoffs,Regular Season] | goals_added | + | player | stage_name=[Playoffs,Regular Season] season_name=2021 | goals_added | | player | action_type=Passing leagues=mls | goals_added | | player | action_type=[Passing,Shooting] leagues=mls | goals_added | | player | above_replacement=true leagues=mls | goals_added | @@ -195,7 +195,7 @@ Feature: Stats functions | player | split_by_seasons=true season_name=[2015,2016] | xpass | | player | split_by_games=true season_name=2020 general_position=CB | xpass | | player | stage_name=Playoffs | xpass | - | player | stage_name=[Playoffs,Regular Season] | xpass | + | player | stage_name=[Playoffs,Regular Season] season_name=2021 | xpass | | player | pass_origin_third=Defensive leagues=mls | xpass | | player | pass_origin_third=[Defensive,Middle] leagues=mls | xpass | @@ -236,7 +236,7 @@ Feature: Stats functions | player | start_date=2020-07-01 end_date=2021-07-08 | salaries | | player | position=M season_name=2019 | salaries | | player | position=[D,M] season_name=2018 | salaries | - | player | season_name=[2019,2020] | salaries | + | player | season_name=[2019,2020] position=M | salaries | @team_salaries @@ -254,4 +254,14 @@ Feature: Stats functions | team | split_by_positions=true season_name=2020 | salaries | + Scenario Outline: Expecting multiple rows of data + Given there is an ASA client + When the "get__" function is called with arguments "" + Then there is multiple rows of data + + Examples: + | type | args | stat | + | game | leagues=mls game_id=[aDQ037dpqE,NPqxr10gM9] | xgoals | + + # TODO: Add expected failure scenarios diff --git a/python-package/tests/features/steps/common_steps.py b/python-package/tests/features/steps/common_steps.py index f416c04..5a0c426 100644 --- a/python-package/tests/features/steps/common_steps.py +++ b/python-package/tests/features/steps/common_steps.py @@ -29,6 +29,12 @@ def step_impl(context): assert isinstance(context.response, DataFrame) assert len(context.response) >= 1 +@then("there is multiple rows of data") +def step_impl(context): + assert context.response is not None + assert isinstance(context.response, DataFrame) + assert len(context.response) >= 2 + @when('the "{function}" function is called with arguments "{args}"') def step_impl(context, function, args): kwargs = split_args(args)