@@ -33,19 +33,19 @@ def test_simple_identifiers_become_dict(self):
3333 self .assertEqual (result , {"A" : "a" , "B" : "b" , "C" : "c" })
3434
3535 def test_explicit_equals_projection (self ):
36- result = _parse_projection ("B= b, M= p, H= h, E= e" )
36+ result = _parse_projection ("B: b, M: p, H: h, E: e" )
3737 self .assertEqual (result , {"B" : "b" , "M" : "p" , "H" : "h" , "E" : "e" })
3838
3939 def test_mixed_implicit_and_explicit (self ):
40- result = _parse_projection ("b, M= p, h, e" )
40+ result = _parse_projection ("b, M: p, h, e" )
4141 self .assertEqual (result , {"B" : "b" , "M" : "p" , "H" : "h" , "E" : "e" })
4242
4343 def test_single_element (self ):
4444 result = _parse_projection ("x" )
4545 self .assertEqual (result , {"X" : "x" })
4646
4747 def test_single_explicit (self ):
48- result = _parse_projection ("X= y" )
48+ result = _parse_projection ("X: y" )
4949 self .assertEqual (result , {"X" : "y" })
5050
5151 def test_empty_raises_value_error (self ):
@@ -193,7 +193,7 @@ def test_single_input_tensor(self):
193193
194194 def test_dict_projection (self ):
195195 result = _parse_einsum_string (
196- "QK[b, m, p, h] = Q[b, m, h, e] * K[B= b, M= p, H= h, E= e]"
196+ "QK[b, m, p, h] = Q[b, m, h, e] * K[B: b, M: p, H: h, E: e]"
197197 )
198198 k_tensor = result ["tensor_accesses" ][1 ]
199199 self .assertEqual (k_tensor ["name" ], "K" )
@@ -203,20 +203,12 @@ def test_dict_projection(self):
203203
204204 def test_mixed_projection (self ):
205205 result = _parse_einsum_string (
206- "QK[b, m, p, h] = Q[b, m, h, e] * K[b, M= p, h, e]"
206+ "QK[b, m, p, h] = Q[b, m, h, e] * K[b, M: p, h, e]"
207207 )
208208 k_tensor = result ["tensor_accesses" ][1 ]
209209 expected = {"B" : "b" , "M" : "p" , "H" : "h" , "E" : "e" }
210210 self .assertEqual (k_tensor ["projection" ], expected )
211211
212- def test_with_renames_alias (self ):
213- result = _parse_einsum_string (
214- "QK(output)[b, m, p, h] = Q(input)[b, m, h, e] * K(weight)[b, M=p, h, e]"
215- )
216- self .assertEqual (result ["name" ], "QK" )
217- self .assertEqual (
218- result ["renames" ], {"output" : "QK" , "input" : "Q" , "weight" : "K" }
219- )
220212
221213 def test_copy_operation (self ):
222214 result = _parse_einsum_string ("I[b, m, d] = I_in[b, m, d]" )
@@ -300,7 +292,7 @@ def test_entry_with_einsum_key(self):
300292
301293 def test_entry_with_einsum_and_renames (self ):
302294 entry = {
303- "einsum" : "QK[b, m, p, h] = Q[b, m, h, e] * K[b, M= p, h, e]" ,
295+ "einsum" : "QK[b, m, p, h] = Q[b, m, h, e] * K[b, M: p, h, e]" ,
304296 "renames" : {"weight" : "K" , "input" : "Q" },
305297 }
306298 result = _parse_einsum_entry (entry )
@@ -375,16 +367,6 @@ def test_invalid_tensor_accesses_type_raises(self):
375367 with self .assertRaises (ValueError ):
376368 _parse_einsum_entry (entry )
377369
378- def test_rename_already_in_einsum_string_raises (self ):
379- """If the einsum string defines a rename alias and we try to add the same."""
380- entry = {
381- "einsum" : "QK(output)[b] = Q(input)[b]" ,
382- "renames" : {"output" : "QK" }, # output is already set by alias
383- }
384- with self .assertRaises (ValueError ) as ctx :
385- _parse_einsum_entry (entry )
386- self .assertIn ("already exists" , str (ctx .exception ))
387-
388370
389371if __name__ == "__main__" :
390372 unittest .main ()
0 commit comments