Mercurial > p > roundup > code
comparison test/test_cgi.py @ 5652:9689d1bf9bb0
python2/python3 normalization. When exporting CSV, sort lists as they
are ordered differently in python3 vs python2. Also python 3 list
element order seems to not be stable/repeatable between runs. Sometimes
the tests would pass sometimes they wouldn't.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 17 Mar 2019 19:00:43 -0400 |
| parents | f8893e1cde0d |
| children | b1ab8bd18e79 |
comparison
equal
deleted
inserted
replaced
| 5649:f8893e1cde0d | 5652:9689d1bf9bb0 |
|---|---|
| 1523 cl.request = MockNull() | 1523 cl.request = MockNull() |
| 1524 cl.request.wfile = output | 1524 cl.request.wfile = output |
| 1525 # call export version that outputs names | 1525 # call export version that outputs names |
| 1526 actions.ExportCSVAction(cl).handle() | 1526 actions.ExportCSVAction(cl).handle() |
| 1527 #print(output.getvalue()) | 1527 #print(output.getvalue()) |
| 1528 self.assertEquals('id,title,status,keyword,assignedto,nosy\r\n' | 1528 should_be=('id,title,status,keyword,assignedto,nosy\r\n' |
| 1529 '1,foo1,deferred,,"Contrary, Mary","Bork, Chef;demo;Contrary, Mary"\r\n' | 1529 '1,foo1,deferred,,"Contrary, Mary","Bork, Chef;Contrary, Mary;demo"\r\n' |
| 1530 '2,bar2,unread,keyword1;keyword2,"Bork, Chef","Bork, Chef"\r\n' | 1530 '2,bar2,unread,keyword1;keyword2,"Bork, Chef","Bork, Chef"\r\n' |
| 1531 '3,baz32,need-eg,,,\r\n', | 1531 '3,baz32,need-eg,,,\r\n') |
| 1532 | 1532 #print(should_be) |
| 1533 output.getvalue()) | 1533 #print(output.getvalue()) |
| 1534 self.assertEqual(output.getvalue(), should_be) | |
| 1534 output = StringIO() | 1535 output = StringIO() |
| 1535 cl.request = MockNull() | 1536 cl.request = MockNull() |
| 1536 cl.request.wfile = output | 1537 cl.request.wfile = output |
| 1537 # call export version that outputs id numbers | 1538 # call export version that outputs id numbers |
| 1538 actions.ExportCSVWithIdAction(cl).handle() | 1539 actions.ExportCSVWithIdAction(cl).handle() |
| 1539 #print(output.getvalue()) | 1540 print(output.getvalue()) |
| 1540 self.assertEquals('id,title,status,keyword,assignedto,nosy\r\n' | 1541 self.assertEquals('id,title,status,keyword,assignedto,nosy\r\n' |
| 1541 "1,foo1,2,[],4,\"['3', '5', '4']\"\r\n" | 1542 "1,foo1,2,[],4,\"['3', '4', '5']\"\r\n" |
| 1542 "2,bar2,1,\"['1', '2']\",3,['3']\r\n" | 1543 "2,bar2,1,\"['1', '2']\",3,['3']\r\n" |
| 1543 '3,baz32,4,[],None,[]\r\n', | 1544 '3,baz32,4,[],None,[]\r\n', |
| 1544 output.getvalue()) | 1545 output.getvalue()) |
| 1545 | 1546 |
| 1546 def testCSVExportBadColumnName(self): | 1547 def testCSVExportBadColumnName(self): |
