Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sdabhi23 committed Mar 14, 2024
1 parent ba8d3a6 commit 4433cdb
Showing 1 changed file with 24 additions and 15 deletions.
39 changes: 24 additions & 15 deletions test_bsedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"""

import random
import time
import pytest
import datetime
Expand All @@ -33,6 +34,11 @@
b = BSE(update_codes=True)


@pytest.fixture(autouse=True)
def slow_tests():
time.sleep(1)


def test_str():
assert str(b) == "Driver Class for Bombay Stock Exchange (BSE)"

Expand Down Expand Up @@ -85,22 +91,25 @@ def test_verifyCode_invalid():
assert b.verifyScripCode("534980") == None


@pytest.mark.parametrize(
"category",
[
"market_cap/broad",
"sector_and_industry",
"thematics",
"strategy",
"sustainability",
"volatility",
"composite",
"government",
"corporate",
"money_market",
],
)
all_categories = [
"market_cap/broad",
"sector_and_industry",
"thematics",
"strategy",
"sustainability",
"volatility",
"composite",
"government",
"corporate",
"money_market",
]

test_categories = random.choices(all_categories, k=3)


@pytest.mark.parametrize("category", test_categories)
def test_getIndices(category):

indices = b.getIndices(category)
datetime.datetime.strptime(indices["updatedOn"], "%d %b %Y")
assert len(indices["indices"]) >= 1
Expand Down

0 comments on commit 4433cdb

Please sign in to comment.