@@ -35,6 +35,14 @@ def test_upload_image_local(self, mock_file2jpeg):
35
35
f"&sequence_number=1&sequence_size=10&tag=lonely-tag"
36
36
),
37
37
},
38
+ {
39
+ "desc" : "without batch_name" ,
40
+ "expected_url" : (
41
+ f"{ API_URL } /dataset/{ self .PROJECT_URL } /upload?"
42
+ f"api_key={ self .API_KEY } &batch={ urllib .parse .quote_plus (DEFAULT_BATCH_NAME )} "
43
+ f"&sequence_number=1&sequence_size=10&tag=lonely-tag"
44
+ ),
45
+ },
38
46
{
39
47
"desc" : "without batch_name" ,
40
48
"batch_name" : None ,
@@ -57,7 +65,7 @@ def test_upload_image_local(self, mock_file2jpeg):
57
65
"tag_names" : self .TAG_NAMES_LOCAL ,
58
66
}
59
67
60
- if scenario [ "batch_name" ] is not None :
68
+ if "batch_name" in scenario :
61
69
upload_image_payload ["batch_name" ] = scenario ["batch_name" ]
62
70
63
71
result = upload_image (self .API_KEY , self .PROJECT_URL , self .IMAGE_PATH_LOCAL , ** upload_image_payload )
@@ -76,6 +84,15 @@ def test_upload_image_hosted(self):
76
84
f"&batch=My%20batch&tag=tag1&tag=tag2"
77
85
),
78
86
},
87
+ {
88
+ "desc" : "without batch_name" ,
89
+ "expected_url" : (
90
+ f"{ API_URL } /dataset/{ self .PROJECT_URL } /upload?"
91
+ f"api_key={ self .API_KEY } &batch={ urllib .parse .quote_plus (DEFAULT_BATCH_NAME )} "
92
+ f"&name={ self .IMAGE_NAME_HOSTED } &split=train"
93
+ f"&image={ urllib .parse .quote_plus (self .IMAGE_PATH_HOSTED )} &tag=tag1&tag=tag2"
94
+ ),
95
+ },
79
96
{
80
97
"desc" : "without batch_name" ,
81
98
"batch_name" : None ,
@@ -98,7 +115,7 @@ def test_upload_image_hosted(self):
98
115
"tag_names" : self .TAG_NAMES_HOSTED ,
99
116
}
100
117
101
- if scenario [ "batch_name" ] is not None :
118
+ if "batch_name" in scenario :
102
119
upload_image_payload ["batch_name" ] = scenario ["batch_name" ]
103
120
104
121
result = upload_image (self .API_KEY , self .PROJECT_URL , self .IMAGE_PATH_HOSTED , ** upload_image_payload )
0 commit comments