def test_reorder_with__not_None(self): from RestrictedPython.Utilities import reorder before = ['a', 'b', 'c', 'd', 'e'] with_ = ['a', 'd'] without = ['a', 'c', 'e'] after = reorder(before, with_=with_, without=without) self.assertEqual(after, [('d', 'd')])
def test_reorder_with__not_None(): from RestrictedPython.Utilities import reorder before = ['a', 'b', 'c', 'd', 'e'] with_ = ['a', 'd'] without = ['a', 'c', 'e'] after = reorder(before, with_=with_, without=without) assert after == [('d', 'd')]
def test_Utilities__reorder_1(): """It also supports 2-tuples containing key, value.""" s = [('k1', 'v1'), ('k2', 'v2'), ('k3', 'v3')] _with = [('k2', 'v2'), ('k3', 'v3')] without = [('k2', 'v2'), ('k4', 'v4')] assert reorder(s, _with, without) == [('k3', 'v3')]