Lines Matching refs:pairs
722 # test random pairs of multisets
770 pairs = [('a', 1), ('b', 2), ('c', 3), ('d', 4), ('e', 5)]
771 self.assertEqual(sorted(OrderedDict(dict(pairs)).items()), pairs) # dict input
772 self.assertEqual(sorted(OrderedDict(**dict(pairs)).items()), pairs) # kwds input
773 self.assertEqual(list(OrderedDict(pairs).items()), pairs) # pairs input
775 c=3, e=5).items()), pairs) # mixed input
790 pairs = [('a', 1), ('b', 2), ('c', 3), ('d', 4), ('e', 5)]
792 od.update(dict(pairs))
793 self.assertEqual(sorted(od.items()), pairs) # dict input
795 od.update(**dict(pairs))
796 self.assertEqual(sorted(od.items()), pairs) # kwds input
798 od.update(pairs)
799 self.assertEqual(list(od.items()), pairs) # pairs input
802 self.assertEqual(list(od.items()), pairs) # mixed input
829 pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]
830 shuffle(pairs)
831 od = OrderedDict(pairs)
832 self.assertEqual(len(od), len(pairs))
837 pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]
838 od = OrderedDict(pairs)
843 self.assertEqual(list(od.items()), pairs[:2] + pairs[3:])
853 pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]
854 shuffle(pairs)
855 od = OrderedDict(pairs)
856 self.assertEqual(list(od), [t[0] for t in pairs])
857 self.assertEqual(od.keys()[:], [t[0] for t in pairs])
858 self.assertEqual(od.values()[:], [t[1] for t in pairs])
859 self.assertEqual(od.items()[:], pairs)
860 self.assertEqual(list(od.iterkeys()), [t[0] for t in pairs])
861 self.assertEqual(list(od.itervalues()), [t[1] for t in pairs])
862 self.assertEqual(list(od.iteritems()), pairs)
864 [t[0] for t in reversed(pairs)])
867 pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]
868 shuffle(pairs)
869 od = OrderedDict(pairs)
870 while pairs:
871 self.assertEqual(od.popitem(), pairs.pop())
877 pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]
878 shuffle(pairs)
879 od = OrderedDict(pairs)
880 shuffle(pairs)
881 while pairs:
882 k, v = pairs.pop()
901 pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]
902 shuffle(pairs)
903 od1 = OrderedDict(pairs)
904 od2 = OrderedDict(pairs)
906 pairs = pairs[2:] + pairs[:2]
907 od2 = OrderedDict(pairs)
913 self.assertNotEqual(od1, OrderedDict(pairs[:-1]))
918 pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]
919 od = OrderedDict(pairs)
943 pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]
944 od = OrderedDict(pairs)
951 pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]
952 od = OrderedDict(pairs)
972 pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]
973 shuffle(pairs)
974 od = OrderedDict(pairs)