1919from pathlib import Path
2020import re
2121
22- from httpx import URL
2322import pytest
2423
2524from planet import models
3029
3130def test_StreamingBody_name_filename ():
3231 r = MagicMock (name = 'response' )
33- r .url = URL ( 'https://planet.com/path/to/example.tif?foo=f6f1' )
32+ r .url = 'https://planet.com/path/to/example.tif?foo=f6f1'
3433 r .headers = {
3534 'date' : 'Thu, 14 Feb 2019 16:13:26 GMT' ,
3635 'last-modified' : 'Wed, 22 Nov 2017 17:22:31 GMT' ,
@@ -45,7 +44,7 @@ def test_StreamingBody_name_filename():
4544
4645def test_StreamingBody_name_url ():
4746 r = MagicMock (name = 'response' )
48- r .url = URL ( 'https://planet.com/path/to/example.tif?foo=f6f1' )
47+ r .url = 'https://planet.com/path/to/example.tif?foo=f6f1'
4948 r .headers = {
5049 'date' : 'Thu, 14 Feb 2019 16:13:26 GMT' ,
5150 'last-modified' : 'Wed, 22 Nov 2017 17:22:31 GMT' ,
@@ -60,7 +59,7 @@ def test_StreamingBody_name_url():
6059
6160def test_StreamingBody_name_content ():
6261 r = MagicMock (name = 'response' )
63- r .url = URL ( 'https://planet.com/path/to/noname/' )
62+ r .url = 'https://planet.com/path/to/noname/'
6463 r .headers = {
6564 'date' : 'Thu, 14 Feb 2019 16:13:26 GMT' ,
6665 'last-modified' : 'Wed, 22 Nov 2017 17:22:31 GMT' ,
@@ -102,12 +101,12 @@ def test__get_filename_from_headers(headers, expected):
102101@pytest .mark .parametrize (
103102 'url,expected' ,
104103 [
105- (URL ( 'https://planet.com/' ) , None ),
106- (URL ( 'https://planet.com/path/to/' ) , None ),
107- (URL ( 'https://planet.com/path/to/example.tif' ) , 'example.tif' ),
108- (URL ( 'https://planet.com/path/to/example.tif?foo=f6f1&bar=baz' ) ,
104+ ('https://planet.com/' , None ),
105+ ('https://planet.com/path/to/' , None ),
106+ ('https://planet.com/path/to/example.tif' , 'example.tif' ),
107+ ('https://planet.com/path/to/example.tif?foo=f6f1&bar=baz' ,
109108 'example.tif' ),
110- (URL ( 'https://planet.com/path/to/example.tif?foo=f6f1#quux' ) ,
109+ ('https://planet.com/path/to/example.tif?foo=f6f1#quux' ,
111110 'example.tif' ),
112111 ])
113112def test__get_filename_from_url (url , expected ):
0 commit comments