@@ -42,25 +42,25 @@ def test_delay():
4242 premium_pf = ProxyFetcher (exclude_used = False )
4343
4444 with patch .object (requests , "get" , return_value = MOCK_RESP ):
45- _ = pf1 .get_proxy ()
45+ _ = pf1 .get ()
4646
4747 # Make sure there is a delay for the same one
4848 start = dt .now ()
4949 pf1 .drain ()
50- _ = pf1 .get_proxy ()
50+ _ = pf1 .get ()
5151 assert (dt .now () - start ).total_seconds () > 1.0
5252
5353 # Even in the middle of other `ProxyFetcher`s getting rate limited the
5454 # premium one should have no delay
5555 start = dt .now ()
5656 premium_pf .drain ()
57- _ = premium_pf .get_proxy ()
57+ _ = premium_pf .get ()
5858 assert (dt .now () - start ).total_seconds () < 0.1
5959
6060 # Even though it's a separate `ProxyFetcher` the delay should be
6161 # coordinated
6262 start = dt .now ()
63- _ = pf2 .get_proxy ()
63+ _ = pf2 .get ()
6464 assert (dt .now () - start ).total_seconds () > 1.0
6565
6666
@@ -136,25 +136,25 @@ def test_blacklist():
136136 # even though `pf1` and `pf2` will get the same proxies, they should
137137 # only return a single unique list between the both of them
138138 assert {
139- pf1 .get_proxy (),
140- pf2 .get_proxy (),
141- pf1 .get_proxy (),
142- pf2 .get_proxy (),
143- pf1 .get_proxy (),
139+ * pf1 .get (),
140+ * pf2 .get (),
141+ * pf1 .get (),
142+ * pf2 .get (),
143+ * pf1 .get (),
144144 } == set (PROXIES )
145145
146146
147147def test_methods ():
148148 pf = ProxyFetcher ()
149149
150150 with patch .object (requests , "get" , return_value = MOCK_RESP ):
151- single = pf .get_proxy ()
152- assert type (single ) == str
151+ single = pf .get ()
152+ assert len (single ) == 1
153153
154- double = pf .get_proxies (2 )
154+ double = pf .get (2 )
155155 assert len (double ) == 2
156156
157157 the_rest = pf .drain ()
158- assert len (the_rest ) == len (PROXIES ) - 1 - 2
158+ assert len (the_rest ) == len (PROXIES ) - len ( single ) - len ( double )
159159
160- assert set ([ single , * double , * the_rest ]) == set (PROXIES )
160+ assert { * single , * double , * the_rest } == set (PROXIES )
0 commit comments