Skip to content

Commit

Permalink
Adding tests for LabelGrid, re-organization of tests into a directory
Browse files Browse the repository at this point in the history
  • Loading branch information
slightlynybbled committed May 7, 2018
1 parent e2389e3 commit 2faebf1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ install:

script:
- "flake8 tk_tools"
- "py.test test.py"
- "py.test tests/test_basic.py"
- "py.test tests/test_LabelGrid.py"
13 changes: 13 additions & 0 deletions tests/test_LabelGrid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import tkinter as tk

import pytest

from tk_tools import *

from tests.test_basic import root


def test_LabelGrid_header_len_doesnt_match_cols(root):
with pytest.raises(ValueError):
LabelGrid(root, 2, headers=['a', 'b', 'c'])

6 changes: 6 additions & 0 deletions test.py → tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,10 @@ def test_init(root):
bl.grid()
ToolTip(bl, 'some text')

# if the test suite makes it to here, then all widgets
# have been successfully instantiated
assert True




8 changes: 4 additions & 4 deletions tk_tools/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
minus = ''


class Grid(ttk.Frame):
class _Grid(ttk.Frame):
padding = 3

"""
Expand Down Expand Up @@ -94,7 +94,7 @@ def clear(self):
self.remove_row(0)


class LabelGrid(Grid):
class LabelGrid(_Grid):
"""
A table-like display widget.
Expand Down Expand Up @@ -131,7 +131,7 @@ def add_row(self, data: list):
self.rows.append(row)


class EntryGrid(Grid):
class EntryGrid(_Grid):
"""
Add a spreadsheet-like grid of entry widgets.
Expand Down Expand Up @@ -236,7 +236,7 @@ def read(self, as_dicts=True):
return self._read_as_table()


class ButtonGrid(Grid):
class ButtonGrid(_Grid):
"""
A grid of buttons.
Expand Down

0 comments on commit 2faebf1

Please sign in to comment.