Index: Lib/tkinter/test/test_tkinter/test_canvas.py =================================================================== --- Lib/tkinter/test/test_tkinter/test_canvas.py (revision 0) +++ Lib/tkinter/test/test_tkinter/test_canvas.py (revision 0) @@ -0,0 +1,32 @@ +import unittest +import tkinter +from test.support import requires, run_unittest + +requires('gui') + +class CanvasTest(unittest.TestCase): + def setUp(self): + self.canvas = tkinter.Canvas() + + def tearDown(self): + self.canvas.destroy() + + def test_coords_islist(self): + """Checks if Canvas.coords returns list as its docstring suggests""" + self.assertIsInstance(self.canvas.coords(0), list) + + def test_coords_empty(self): + """ Canvas.coords should return empty list if item does not exists """ + self.assertEqual([], self.canvas.coords(1)) + + def test_coords_created(self): + """ Checks if Canvas.coords returns correct coords """ + line_args = [0.0, 0.0, 1.0, 1.0] + line = self.canvas.create_line(*line_args) + self.assertEqual(line_args, self.canvas.coords(line)) + +tests_gui = (CanvasTest,) + +if __name__ == '__main__': + run_unittest(*tests_gui) + Index: Lib/tkinter/__init__.py =================================================================== --- Lib/tkinter/__init__.py (revision 83065) +++ Lib/tkinter/__init__.py (working copy) @@ -2157,9 +2157,9 @@ def coords(self, *args): """Return a list of coordinates for the item given in ARGS.""" # XXX Should use _flatten on args - return map(getdouble, + return list(map(getdouble, self.tk.splitlist( - self.tk.call((self._w, 'coords') + args))) + self.tk.call((self._w, 'coords') + args)))) def _create(self, itemType, args, kw): # Args: (val, val, ..., cnf={}) """Internal function.""" args = _flatten(args)