@@ -665,73 +665,29 @@ def test_set_of_sets_reprs(self):
665
665
self .assertEqual (pprint .pformat (data ), repr (data ))
666
666
667
667
# Single-line, unordered:
668
- self .assertIn (
669
- pprint .pformat (
670
- frozenset ((
671
- frozenset (("xyz" , "qwerty" )),
672
- frozenset (("abcd" , "spam" ))),
673
- ),
674
- ),
675
- [
676
- "frozenset({frozenset({'qwerty', 'xyz'}), frozenset({'spam', 'abcd'})})" ,
677
- "frozenset({frozenset({'xyz', 'qwerty'}), frozenset({'spam', 'abcd'})})" ,
678
- "frozenset({frozenset({'qwerty', 'xyz'}), frozenset({'abcd', 'spam'})})" ,
679
- "frozenset({frozenset({'xyz', 'qwerty'}), frozenset({'abcd', 'spam'})})" ,
680
-
681
- "frozenset({frozenset({'spam', 'abcd'}), frozenset({'qwerty', 'xyz'})})" ,
682
- "frozenset({frozenset({'spam', 'abcd'}), frozenset({'xyz', 'qwerty'})})" ,
683
- "frozenset({frozenset({'abcd', 'spam'}), frozenset({'qwerty', 'xyz'})})" ,
684
- "frozenset({frozenset({'abcd', 'spam'}), frozenset({'xyz', 'qwerty'})})" ,
685
-
686
- ],
687
- )
668
+ fs1 = frozenset (("xyz" , "qwerty" ))
669
+ fs2 = frozenset (("abcd" , "spam" ))
670
+ fs = frozenset ((fs1 , fs2 )))
671
+ self .assertEqual (pprint .pformat (fs , repr (fs ))
688
672
689
673
# Multiline, unordered:
690
674
def check (res , invariants ):
691
675
self .assertIn (res , [textwrap .dedent (i ).strip () for i in invariants ])
692
676
693
677
# Inner-most frozensets are singleline, result is multiline, unordered:
678
+ fs1 = frozenset (('regular string' , 'other string' ))
679
+ fs2 = frozenset (('third string' , 'one more string' ))
694
680
check (
695
- pprint .pformat (
696
- frozenset ((
697
- frozenset (('regular string' , 'other string' )),
698
- frozenset (('third string' , 'one more string' )),
699
- ))
700
- ),
681
+ pprint .pformat (frozenset ((fs1 , fs2 ))),
701
682
[
702
683
"""
703
- frozenset({frozenset({'regular string', 'other string'}),
704
- frozenset({'third string', 'one more string'})})
705
- """ ,
706
- """
707
- frozenset({frozenset({'regular string', 'other string'}),
708
- frozenset({'one more string', 'third string'})})
709
- """ ,
710
- """
711
- frozenset({frozenset({'other string', 'regular string'}),
712
- frozenset({'third string', 'one more string'})})
713
- """ ,
714
- """
715
- frozenset({frozenset({'other string', 'regular string'}),
716
- frozenset({'one more string', 'third string'})})
717
- """ ,
718
- # -
719
- """
720
- frozenset({frozenset({'third string', 'one more string'}),
721
- frozenset({'regular string', 'other string'})})
722
- """ ,
723
- """
724
- frozenset({frozenset({'third string', 'one more string'}),
725
- frozenset({'other string', 'regular string'})})
726
- """ ,
727
- """
728
- frozenset({frozenset({'one more string', 'third string'}),
729
- frozenset({'regular string', 'other string'})})
730
- """ ,
684
+ frozenset({%r,
685
+ %r})
686
+ """ % (fs1 , fs2 ),
731
687
"""
732
- frozenset({frozenset({'one more string', 'third string'}) ,
733
- frozenset({'other string', 'regular string'}) })
734
- """ ,
688
+ frozenset({%r ,
689
+ %r })
690
+ """ % ( fs2 , fs1 ) ,
735
691
],
736
692
)
737
693
0 commit comments