Skip to content

Commit 4e7870e

Browse files
authored
add tests for iteratorGenerator (#120)
1 parent eab2a9a commit 4e7870e

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

tests/test_report_objects.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,6 +1807,58 @@ def test_statistical_generator() -> bool:
18071807
assert succ and succ_two and succ_three and succ_four and succ_five and succ_six
18081808

18091809

1810+
@pytest.mark.ado_test
1811+
def test_generator_iterator() -> bool:
1812+
a = ro.iteratorGeneratorREST()
1813+
succ = a.get_iteration_tags() == ["", ""]
1814+
a.set_iteration_tags()
1815+
succ_two = False
1816+
try:
1817+
a.set_iteration_tags(value=1)
1818+
except ValueError as e:
1819+
succ_two = "Error: input needs to be a list" in str(e)
1820+
succ_three = False
1821+
try:
1822+
a.set_iteration_tags(value=[])
1823+
except ValueError as e:
1824+
succ_three = "needs to contain 2 elements" in str(e)
1825+
succ_four = False
1826+
try:
1827+
a.set_iteration_tags(value=[1, 1])
1828+
except ValueError as e:
1829+
succ_four = "need to be strings" in str(e)
1830+
a.set_iteration_tags(value=["tag", "a"])
1831+
succ_five = a.get_iteration_tags() == ["tag", "a"]
1832+
a.set_iteration_tags(value=["", ""])
1833+
succ_six = a.get_iteration_tags() == ["", ""]
1834+
a.set_iteration_tags(value=["tag", "a"])
1835+
succ_seven = a.get_sort_tag() == [True, False]
1836+
a.set_iteration_tags(value=["sort", "reverse_sort"])
1837+
succ_eight = a.get_sort_tag() == [True, False]
1838+
a.set_sort_tag()
1839+
succ_nine = False
1840+
try:
1841+
a.set_sort_tag(value=1)
1842+
except ValueError as e:
1843+
succ_nine = "input needs to be a list" in str(e)
1844+
succ_ten = False
1845+
try:
1846+
a.set_sort_tag(value=[1])
1847+
except ValueError as e:
1848+
succ_ten = "contain 2 elements" in str(e)
1849+
succ_eleven = False
1850+
try:
1851+
a.set_sort_tag(value=[1, 1])
1852+
except ValueError as e:
1853+
succ_eleven = "need to be True/False" in str(e)
1854+
a.set_sort_tag(value=[False, True])
1855+
succ_twelve = a.get_sort_tag() == [False, False]
1856+
succ_a = succ and succ_two + succ_three + succ_four + succ_five
1857+
succ_b = succ_six + succ_seven + succ_eight + succ_nine
1858+
succ_c = succ_ten + succ_eleven + succ_twelve
1859+
assert succ_a and succ_b and succ_c
1860+
1861+
18101862
def test_item_payload(adr_service_query) -> bool:
18111863
try:
18121864
for i in adr_service_query.query():

0 commit comments

Comments
 (0)