[Python-checkins] python/dist/src/Lib/test test_repr.py,1.17,1.18

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Fri May 21 06:00:19 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11427/test

Modified Files:
	test_repr.py 
Log Message:
* Updated repr.py to handle set() and frozenset().
* Factored out common code to a single private function.
* Use str.join() instead of + concatenation
* Loop over elements directly instead of using indexing
* Use % operator for formatting



Index: test_repr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_repr.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** test_repr.py	12 Feb 2004 17:35:11 -0000	1.17
--- test_repr.py	21 May 2004 10:00:15 -0000	1.18
***************
*** 52,55 ****
--- 52,69 ----
          eq(r([1, 2, 3, 4, 5, 6, 7]), "[1, 2, 3, 4, 5, 6, ...]")
  
+         # Sets give up after 6 as well
+         eq(r(set([])), "set([])")
+         eq(r(set([1])), "set([1])")
+         eq(r(set([1, 2, 3])), "set([1, 2, 3])")
+         eq(r(set([1, 2, 3, 4, 5, 6])), "set([1, 2, 3, 4, 5, 6])")
+         eq(r(set([1, 2, 3, 4, 5, 6, 7])), "set([1, 2, 3, 4, 5, 6, ...])")
+ 
+         # Frozensets give up after 6 as well
+         eq(r(frozenset([])), "frozenset([])")
+         eq(r(frozenset([1])), "frozenset([1])")
+         eq(r(frozenset([1, 2, 3])), "frozenset([1, 2, 3])")
+         eq(r(frozenset([1, 2, 3, 4, 5, 6])), "frozenset([1, 2, 3, 4, 5, 6])")
+         eq(r(frozenset([1, 2, 3, 4, 5, 6, 7])), "frozenset([1, 2, 3, 4, 5, 6, ...])")
+ 
          # Dictionaries give up after 4.
          eq(r({}), "{}")




More information about the Python-checkins mailing list