@@ -210,11 +210,9 @@ def _verify_resource_properties(self, dataset, resource):
210210 self .assertEqual (dataset .access_entries , [])
211211
212212 def test_ctor_defaults (self ):
213- client = _Client (self .PROJECT )
214- dataset = self ._make_one (self .DS_ID , client )
213+ dataset = self ._make_one (self .DS_ID , project = self .PROJECT )
215214 self .assertEqual (dataset .dataset_id , self .DS_ID )
216- self .assertIs (dataset ._client , client )
217- self .assertEqual (dataset .project , client .project )
215+ self .assertEqual (dataset .project , self .PROJECT )
218216 self .assertEqual (
219217 dataset .path ,
220218 '/projects/%s/datasets/%s' % (self .PROJECT , self .DS_ID ))
@@ -238,12 +236,10 @@ def test_ctor_explicit(self):
238236 bharney = AccessEntry ('OWNER' , 'userByEmail' , 'bharney@example.com' )
239237 entries = [phred , bharney ]
240238 OTHER_PROJECT = 'foo-bar-123'
241- client = _Client (self .PROJECT )
242- dataset = self ._make_one (self .DS_ID , client ,
239+ dataset = self ._make_one (self .DS_ID ,
243240 access_entries = entries ,
244241 project = OTHER_PROJECT )
245242 self .assertEqual (dataset .dataset_id , self .DS_ID )
246- self .assertIs (dataset ._client , client )
247243 self .assertEqual (dataset .project , OTHER_PROJECT )
248244 self .assertEqual (
249245 dataset .path ,
@@ -262,89 +258,76 @@ def test_ctor_explicit(self):
262258 self .assertIsNone (dataset .location )
263259
264260 def test_access_entries_setter_non_list (self ):
265- client = _Client (self .PROJECT )
266- dataset = self ._make_one (self .DS_ID , client )
261+ dataset = self ._make_one (self .DS_ID )
267262 with self .assertRaises (TypeError ):
268263 dataset .access_entries = object ()
269264
270265 def test_access_entries_setter_invalid_field (self ):
271266 from google .cloud .bigquery .dataset import AccessEntry
272267
273- client = _Client (self .PROJECT )
274- dataset = self ._make_one (self .DS_ID , client )
268+ dataset = self ._make_one (self .DS_ID )
275269 phred = AccessEntry ('OWNER' , 'userByEmail' , 'phred@example.com' )
276270 with self .assertRaises (ValueError ):
277271 dataset .access_entries = [phred , object ()]
278272
279273 def test_access_entries_setter (self ):
280274 from google .cloud .bigquery .dataset import AccessEntry
281275
282- client = _Client (self .PROJECT )
283- dataset = self ._make_one (self .DS_ID , client )
276+ dataset = self ._make_one (self .DS_ID )
284277 phred = AccessEntry ('OWNER' , 'userByEmail' , 'phred@example.com' )
285278 bharney = AccessEntry ('OWNER' , 'userByEmail' , 'bharney@example.com' )
286279 dataset .access_entries = [phred , bharney ]
287280 self .assertEqual (dataset .access_entries , [phred , bharney ])
288281
289282 def test_default_table_expiration_ms_setter_bad_value (self ):
290- client = _Client (self .PROJECT )
291- dataset = self ._make_one (self .DS_ID , client )
283+ dataset = self ._make_one (self .DS_ID )
292284 with self .assertRaises (ValueError ):
293285 dataset .default_table_expiration_ms = 'bogus'
294286
295287 def test_default_table_expiration_ms_setter (self ):
296- client = _Client (self .PROJECT )
297- dataset = self ._make_one (self .DS_ID , client )
288+ dataset = self ._make_one (self .DS_ID )
298289 dataset .default_table_expiration_ms = 12345
299290 self .assertEqual (dataset .default_table_expiration_ms , 12345 )
300291
301292 def test_description_setter_bad_value (self ):
302- client = _Client (self .PROJECT )
303- dataset = self ._make_one (self .DS_ID , client )
293+ dataset = self ._make_one (self .DS_ID )
304294 with self .assertRaises (ValueError ):
305295 dataset .description = 12345
306296
307297 def test_description_setter (self ):
308- client = _Client (self .PROJECT )
309- dataset = self ._make_one (self .DS_ID , client )
298+ dataset = self ._make_one (self .DS_ID )
310299 dataset .description = 'DESCRIPTION'
311300 self .assertEqual (dataset .description , 'DESCRIPTION' )
312301
313302 def test_friendly_name_setter_bad_value (self ):
314- client = _Client (self .PROJECT )
315- dataset = self ._make_one (self .DS_ID , client )
303+ dataset = self ._make_one (self .DS_ID )
316304 with self .assertRaises (ValueError ):
317305 dataset .friendly_name = 12345
318306
319307 def test_friendly_name_setter (self ):
320- client = _Client (self .PROJECT )
321- dataset = self ._make_one (self .DS_ID , client )
308+ dataset = self ._make_one (self .DS_ID )
322309 dataset .friendly_name = 'FRIENDLY'
323310 self .assertEqual (dataset .friendly_name , 'FRIENDLY' )
324311
325312 def test_location_setter_bad_value (self ):
326- client = _Client (self .PROJECT )
327- dataset = self ._make_one (self .DS_ID , client )
313+ dataset = self ._make_one (self .DS_ID )
328314 with self .assertRaises (ValueError ):
329315 dataset .location = 12345
330316
331317 def test_location_setter (self ):
332- client = _Client (self .PROJECT )
333- dataset = self ._make_one (self .DS_ID , client )
318+ dataset = self ._make_one (self .DS_ID )
334319 dataset .location = 'LOCATION'
335320 self .assertEqual (dataset .location , 'LOCATION' )
336321
337322 def test_from_api_repr_missing_identity (self ):
338323 self ._setUpConstants ()
339- client = _Client (self .PROJECT )
340324 RESOURCE = {}
341325 klass = self ._get_target_class ()
342326 with self .assertRaises (KeyError ):
343- klass .from_api_repr (RESOURCE , client = client )
327+ klass .from_api_repr (RESOURCE )
344328
345329 def test_from_api_repr_bare (self ):
346330 self ._setUpConstants ()
347- client = _Client (self .PROJECT )
348331 RESOURCE = {
349332 'id' : '%s:%s' % (self .PROJECT , self .DS_ID ),
350333 'datasetReference' : {
@@ -353,24 +336,20 @@ def test_from_api_repr_bare(self):
353336 }
354337 }
355338 klass = self ._get_target_class ()
356- dataset = klass .from_api_repr (RESOURCE , client = client )
357- self .assertIs (dataset ._client , client )
339+ dataset = klass .from_api_repr (RESOURCE )
358340 self ._verify_resource_properties (dataset , RESOURCE )
359341
360342 def test_from_api_repr_w_properties (self ):
361- client = _Client (self .PROJECT )
362343 RESOURCE = self ._makeResource ()
363344 klass = self ._get_target_class ()
364- dataset = klass .from_api_repr (RESOURCE , client = client )
365- self .assertIs (dataset ._client , client )
345+ dataset = klass .from_api_repr (RESOURCE )
366346 self ._verify_resource_properties (dataset , RESOURCE )
367347
368348 def test__parse_access_entries_w_unknown_entity_type (self ):
369349 ACCESS = [
370350 {'role' : 'READER' , 'unknown' : 'UNKNOWN' },
371351 ]
372- client = _Client (self .PROJECT )
373- dataset = self ._make_one (self .DS_ID , client = client )
352+ dataset = self ._make_one (self .DS_ID )
374353 with self .assertRaises (ValueError ):
375354 dataset ._parse_access_entries (ACCESS )
376355
@@ -383,24 +362,16 @@ def test__parse_access_entries_w_extra_keys(self):
383362 'userByEmail' : USER_EMAIL ,
384363 },
385364 ]
386- client = _Client (self .PROJECT )
387- dataset = self ._make_one (self .DS_ID , client = client )
365+ dataset = self ._make_one (self .DS_ID )
388366 with self .assertRaises (ValueError ):
389367 dataset ._parse_access_entries (ACCESS )
390368
391369 def test_table (self ):
392370 from google .cloud .bigquery .table import TableReference
393371
394- client = _Client (project = self .PROJECT )
395- dataset = self ._make_one (self .DS_ID , client = client )
372+ dataset = self ._make_one (self .DS_ID , project = self .PROJECT )
396373 table = dataset .table ('table_id' )
397374 self .assertIsInstance (table , TableReference )
398375 self .assertEqual (table .table_id , 'table_id' )
399376 self .assertEqual (table .dataset_id , self .DS_ID )
400377 self .assertEqual (table .project , self .PROJECT )
401-
402-
403- class _Client (object ):
404-
405- def __init__ (self , project = 'project' ):
406- self .project = project
0 commit comments