@@ -650,7 +650,7 @@ def test_merge_one_dim_concat_another(self):
650650 expected = Dataset ({'foo' : ('x' , [0 , 1 , 2 , 3 ]),
651651 'bar' : ('x' , [10 , 20 , 30 , 40 ])})
652652
653- actual = auto_combine (objs , concat_dim = ['x' , None ])
653+ actual = auto_combine (objs , concat_dim = ['x' , None ], compat = 'equals' )
654654 assert_identical (expected , actual )
655655
656656 actual = auto_combine (objs )
@@ -661,7 +661,19 @@ def test_merge_one_dim_concat_another(self):
661661 Dataset ({'foo' : ('x' , [2 , 3 ])})],
662662 [Dataset ({'bar' : ('x' , [10 , 20 ])}),
663663 Dataset ({'bar' : ('x' , [30 , 40 ])})]]
664- actual = auto_combine (objs , concat_dim = [None , 'x' ])
664+ actual = auto_combine (objs , concat_dim = [None , 'x' ], compat = 'equals' )
665+ assert_identical (expected , actual )
666+
667+ def test_internal_ordering (self ):
668+ # This gives a MergeError if _auto_combine_1d is not sorting by
669+ # data_vars correctly, see GH #2662
670+ objs = [Dataset ({'foo' : ('x' , [0 , 1 ])}),
671+ Dataset ({'bar' : ('x' , [10 , 20 ])}),
672+ Dataset ({'foo' : ('x' , [2 , 3 ])}),
673+ Dataset ({'bar' : ('x' , [30 , 40 ])})]
674+ actual = auto_combine (objs , concat_dim = 'x' , compat = 'equals' )
675+ expected = Dataset ({'foo' : ('x' , [0 , 1 , 2 , 3 ]),
676+ 'bar' : ('x' , [10 , 20 , 30 , 40 ])})
665677 assert_identical (expected , actual )
666678
667679 def test_combine_concat_over_redundant_nesting (self ):
0 commit comments