@@ -24,18 +24,15 @@ def project_to_test_where(client, rand_gen):
2424
2525# Avoid assertions using equality to prevent intermittent failures due to
2626# other builds simultaneously adding projects to test org
27- def test_where (client , image_url , project_to_test_where , rand_gen ):
27+ def test_where (client , project_to_test_where ):
2828 p_a , p_b , p_c = project_to_test_where
29- p_a_name , p_b_name , p_c_name = [p .name for p in [p_a , p_b , p_c ]]
29+ p_a_name , p_b_name , _ = [p .name for p in [p_a , p_b , p_c ]]
3030
31- def _get ( f , where = None ):
31+ def get ( where = None ):
3232 date_where = Project .created_at >= p_a .created_at
3333 where = date_where if where is None else where & date_where
3434 return {p .uid for p in client .get_projects (where )}
3535
36- def get (where = None ):
37- return _get (client .get_projects , where )
38-
3936 assert {p_a .uid , p_b .uid , p_c .uid }.issubset (get ())
4037 e_a = get (Project .name == p_a_name )
4138 assert p_a .uid in e_a and p_b .uid not in e_a and p_c .uid not in e_a
@@ -50,34 +47,6 @@ def get(where=None):
5047 le_b = get (Project .name <= p_b_name )
5148 assert {p_a .uid , p_b .uid }.issubset (le_b ) and p_c .uid not in le_b
5249
53- dataset = client .create_dataset (name = "Dataset" )
54- data_row = dataset .create_data_row (row_data = image_url )
55- data_row_ids = [data_row .uid ]
56- batch = p_a .create_batch (
57- rand_gen (str ),
58- data_row_ids , # sample of data row objects
59- 5 # priority between 1(Highest) - 5(lowest)
60- )
61-
62- def get (where = None ):
63- return _get (batch .project , where )
64-
65- assert {p_a .uid , p_b .uid , p_c .uid }.issubset (get ())
66- e_a = get (Project .name == p_a_name )
67- assert p_a .uid in e_a and p_b .uid not in e_a and p_c .uid not in e_a
68- not_b = get (Project .name != p_b_name )
69- assert {p_a .uid , p_c .uid }.issubset (not_b ) and p_b .uid not in not_b
70- gt_b = get (Project .name > p_b_name )
71- assert p_c .uid in gt_b and p_a .uid not in gt_b and p_b .uid not in gt_b
72- lt_b = get (Project .name < p_b_name )
73- assert p_a .uid in lt_b and p_b .uid not in lt_b and p_c .uid not in lt_b
74- ge_b = get (Project .name >= p_b_name )
75- assert {p_b .uid , p_c .uid }.issubset (ge_b ) and p_a .uid not in ge_b
76- le_b = get (Project .name <= p_b_name )
77- assert {p_a .uid , p_b .uid }.issubset (le_b ) and p_c .uid not in le_b
78-
79- batch .delete ()
80-
8150
8251def test_unsupported_where (client ):
8352 with pytest .raises (InvalidQueryError ):
@@ -89,4 +58,4 @@ def test_unsupported_where(client):
8958 (Project .description == "b" ))
9059
9160 with pytest .raises (InvalidQueryError ):
92- client .get_projects (where = ~ (Project .name == "a" ))
61+ client .get_projects (where = ~ (Project .name == "a" ))
0 commit comments