classification
Title: Fix the grid geometry manager and add tests for geometry managers
Type: behavior Stage: resolved
Components: Library (Lib), Tests, Tkinter Versions: Python 3.4, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: gpolo, ned.deily, python-dev, serhiy.storchaka, terry.reedy
Priority: normal Keywords: patch

Created on 2014-02-15 11:38 by serhiy.storchaka, last changed 2014-05-23 11:32 by serhiy.storchaka. This issue is now closed.

Files
File name Uploaded Description Edit
test_geometry_managers.patch serhiy.storchaka, 2014-02-15 11:38 review
test_geometry_managers_2.patch serhiy.storchaka, 2014-02-16 19:35 review
test_geometry_managers_2-2.7.patch serhiy.storchaka, 2014-04-13 17:06 review
Messages (10)
msg211268 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-02-15 11:38
Here is a patch which adds tests for Tk geometry managers (pack, place and grid). In additional it fixes the grid_columnconfigure() and grid_rowconfigure() methods which did not worked with wantobject=True (preferable and default mode).
msg211303 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-02-16 00:17
On OS X 10.9 with Cocoa Tk 8.15.0+, Cocoa Tk 8.6, and X11 Tk 8.6:

======================================================================
FAIL: test_place_forget (tkinter.test.test_tkinter.test_geometry_managers.PlaceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_geometry_managers.py", line 440, in test_place_forget
    self.assertTrue(foo.winfo_ismapped())
AssertionError: 0 is not true

----------------------------------------------------------------------

With OS X Carbon Tk 8.4, the grid_anchor and grid_configure tests fail:

======================================================================
ERROR: test_grid_anchor (tkinter.test.test_tkinter.test_geometry_managers.GridTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_geometry_managers.py", line 489, in tearDown
    self.root.grid_anchor('nw')
  File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/__init__.py", line 1321, in grid_anchor
    self.tk.call('grid', 'anchor', self._w, anchor)
_tkinter.TclError: bad option "anchor": must be bbox, columnconfigure, configure, forget, info, location, propagate, remove, rowconfigure, size, or slaves

======================================================================
ERROR: test_grid_columnconfigure (tkinter.test.test_tkinter.test_geometry_managers.GridTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_geometry_managers.py", line 617, in test_grid_columnconfigure
    self.root.grid_columnconfigure('all', weight=3)
  File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/__init__.py", line 1389, in grid_columnconfigure
    return self._grid_configure('columnconfigure', index, cnf, kw)
  File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/__init__.py", line 1379, in _grid_configure
    + options)
_tkinter.TclError: expected integer but got "all"

... along with:

======================================================================
ERROR: test_grid_rowconfigure (tkinter.test.test_tkinter.test_geometry_managers.GridTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_geometry_managers.py", line 671, in test_grid_rowconfigure
    self.root.grid_rowconfigure('all', weight=3)
  File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/__init__.py", line 1416, in grid_rowconfigure
    return self._grid_configure('rowconfigure', index, cnf, kw)
  File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/__init__.py", line 1379, in _grid_configure
    + options)
_tkinter.TclError: expected integer but got "all"

======================================================================
FAIL: test_place_configure_in (tkinter.test.test_tkinter.test_geometry_managers.PlaceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_geometry_managers.py", line 294, in test_place_configure_in
    self.assertEqual(f2.winfo_manager(), '')
AssertionError: 'place' != ''
- place
+


======================================================================
FAIL: test_place_forget (tkinter.test.test_tkinter.test_geometry_managers.PlaceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_geometry_managers.py", line 440, in test_place_forget
    self.assertTrue(foo.winfo_ismapped())
AssertionError: 0 is not true

======================================================================
FAIL: test_grid_configure_row (tkinter.test.test_tkinter.test_geometry_managers.GridTest)
----------------------------------------------------------------------
_tkinter.TclError: bad grid value "-1": must be a non-negative integer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.9.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_geometry_managers.py", line 583, in test_grid_configure_row
    b.grid_configure(row=-1)
AssertionError: "bad row value "-1": must be a non-negative integer" does not match "bad grid value "-1": must be a non-negative integer"

----------------------------------------------------------------------
Ran 597 tests in 4.270s

FAILED (failures=4, errors=32, skipped=16)
msg211348 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-02-16 19:35
My fault. I tested the patch with 8.5 and 8.6, but was too lazy to check it with 8.4. Here is updated patch with workarounded 8.4 peculiarities.

I'm not sure about test_place_forget(). I have removed the check, hope this will help.

Thank you Ned.
msg211569 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-02-18 23:29
With test_geometry_managers_2.patch, test_tk now passes with all of the previously tested OS X Tk versions.
msg211628 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-02-19 16:38
Unfortunately new tests emit on 3.3 and 2.7 same warnings as in issue20567. So I have committed only the fix, without tests.
msg211629 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-02-19 16:40
Changesets 857ddbaff14e (2.7), 6227b0ecb5fb (3.3) and b6df5f8f86d3 (default).
msg216027 - (view) Author: Roundup Robot (python-dev) Date: 2014-04-13 16:55
New changeset e8c184d8407d by Serhiy Storchaka in branch '3.4':
Issue #20635: Added tests for Tk geometry managers.
http://hg.python.org/cpython/rev/e8c184d8407d

New changeset e8acef4f8567 by Serhiy Storchaka in branch 'default':
Issue #20635: Added tests for Tk geometry managers.
http://hg.python.org/cpython/rev/e8acef4f8567
msg216028 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-04-13 17:06
Here is a patch for 2.7.
msg216034 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-04-13 20:32
test_tk with test_geometry_managers_2-2.7.patch applied passed on OS X 10.9 linked with Carbon Tk 8.4.20, Cocoa 8.5.15, Cocoa 8.6.1, and X11 8.6.1.
msg218960 - (view) Author: Roundup Robot (python-dev) Date: 2014-05-23 11:11
New changeset 9ab1225b6cc5 by Serhiy Storchaka in branch '2.7':
Issue #20635: Added tests for Tk geometry managers.
http://hg.python.org/cpython/rev/9ab1225b6cc5
History
Date User Action Args
2014-05-23 11:32:33serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2014-05-23 11:11:32python-devsetmessages: + msg218960
2014-04-13 20:32:00ned.deilysetmessages: + msg216034
2014-04-13 17:57:00serhiy.storchakasetassignee: serhiy.storchaka
2014-04-13 17:06:45serhiy.storchakasetfiles: + test_geometry_managers_2-2.7.patch

messages: + msg216028
2014-04-13 16:55:27python-devsetnosy: + python-dev
messages: + msg216027
2014-02-19 16:40:45serhiy.storchakasetmessages: + msg211629
2014-02-19 16:38:46serhiy.storchakasetmessages: + msg211628
2014-02-18 23:29:48ned.deilysetmessages: + msg211569
2014-02-16 19:35:26serhiy.storchakasetfiles: + test_geometry_managers_2.patch

messages: + msg211348
2014-02-16 00:17:24ned.deilysetnosy: + ned.deily
messages: + msg211303
2014-02-15 11:55:25serhiy.storchakasettitle: Fix the grid geometry manager and add -> Fix the grid geometry manager and add tests for geometry managers
2014-02-15 11:38:22serhiy.storchakacreate