@@ -432,7 +432,7 @@ def test_concat(self):
432
432
assert_identical (
433
433
Variable (["b" , "a" ], np .array ([x , y ])), Variable .concat ((v , w ), "b" )
434
434
)
435
- with raises_regex (ValueError , "inconsistent dimensions" ):
435
+ with raises_regex (ValueError , "Variable has dimensions" ):
436
436
Variable .concat ([v , Variable (["c" ], y )], "b" )
437
437
# test indexers
438
438
actual = Variable .concat (
@@ -451,16 +451,12 @@ def test_concat(self):
451
451
Variable .concat ([v [:, 0 ], v [:, 1 :]], "x" )
452
452
453
453
def test_concat_attrs (self ):
454
- # different or conflicting attributes should be removed
454
+ # always keep attrs from first variable
455
455
v = self .cls ("a" , np .arange (5 ), {"foo" : "bar" })
456
456
w = self .cls ("a" , np .ones (5 ))
457
457
expected = self .cls (
458
458
"a" , np .concatenate ([np .arange (5 ), np .ones (5 )])
459
459
).to_base_variable ()
460
- assert_identical (expected , Variable .concat ([v , w ], "a" ))
461
- w .attrs ["foo" ] = 2
462
- assert_identical (expected , Variable .concat ([v , w ], "a" ))
463
- w .attrs ["foo" ] = "bar"
464
460
expected .attrs ["foo" ] = "bar"
465
461
assert_identical (expected , Variable .concat ([v , w ], "a" ))
466
462
0 commit comments