@@ -102,39 +102,6 @@ def test_to_protobuf_w_explicit_path(self):
102102 self .assertEqual (elems [2 ].name , '' )
103103 self .assertEqual (elems [2 ].id , 0 )
104104
105- def test_from_path_empty (self ):
106- key = self ._getTargetClass ().from_path ()
107- self .assertEqual (key ._dataset_id , None )
108- self .assertEqual (key .namespace (), None )
109- self .assertEqual (key .kind (), '' )
110- self .assertEqual (key .path (), [{'kind' : '' }])
111-
112- def test_from_path_single_element (self ):
113- self .assertRaises (ValueError , self ._getTargetClass ().from_path , 'abc' )
114-
115- def test_from_path_three_elements (self ):
116- self .assertRaises (ValueError , self ._getTargetClass ().from_path ,
117- 'abc' , 'def' , 'ghi' )
118-
119- def test_from_path_two_elements_second_string (self ):
120- key = self ._getTargetClass ().from_path ('abc' , 'def' )
121- self .assertEqual (key .kind (), 'abc' )
122- self .assertEqual (key .path (), [{'kind' : 'abc' , 'name' : 'def' }])
123-
124- def test_from_path_two_elements_second_int (self ):
125- key = self ._getTargetClass ().from_path ('abc' , 123 )
126- self .assertEqual (key .kind (), 'abc' )
127- self .assertEqual (key .path (), [{'kind' : 'abc' , 'id' : 123 }])
128-
129- def test_from_path_nested (self ):
130- key = self ._getTargetClass ().from_path ('abc' , 'def' , 'ghi' , 123 )
131- self .assertEqual (key .kind (), 'ghi' )
132- expected_path = [
133- {'kind' : 'abc' , 'name' : 'def' },
134- {'kind' : 'ghi' , 'id' : 123 },
135- ]
136- self .assertEqual (key .path (), expected_path )
137-
138105 def test_is_partial_no_name_or_id (self ):
139106 key = self ._makeOne ()
140107 self .assertTrue (key .is_partial ())
@@ -282,9 +249,13 @@ def test_parent_default(self):
282249 self .assertEqual (key .parent (), None )
283250
284251 def test_parent_explicit_top_level (self ):
285- key = self ._getTargetClass (). from_path ( ' abc' , 'def' )
252+ key = self ._makeOne ( path = [{ 'kind' : ' abc' , 'name' : ' def'}] )
286253 self .assertEqual (key .parent (), None )
287254
288255 def test_parent_explicit_nested (self ):
289- key = self ._getTargetClass ().from_path ('abc' , 'def' , 'ghi' , 123 )
290- self .assertEqual (key .parent ().path (), [{'kind' : 'abc' , 'name' : 'def' }])
256+ parent_part = {'kind' : 'abc' , 'name' : 'def' }
257+ key = self ._makeOne (path = [
258+ parent_part ,
259+ {'kind' : 'ghi' , 'id' : 123 },
260+ ])
261+ self .assertEqual (key .parent ().path (), [parent_part ])
0 commit comments