Skip to content

Commit

Permalink
Merge pull request #42 from jonathanciapetti/0.2.2
Browse files Browse the repository at this point in the history
0.2.2
  • Loading branch information
jonathanciapetti committed Jul 1, 2024
2 parents 8896b97 + 2f9e31e commit 7cf0538
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

![workflow](https://github.com/jonathanciapetti/picklevw/actions/workflows/python-app.yml/badge.svg)
[![codecov](https://codecov.io/github/jonathanciapetti/picklevw/graph/badge.svg?token=UCDTWBNL7A)](https://codecov.io/github/jonathanciapetti/picklevw)
![version](https://img.shields.io/badge/version-0.2.1-blue)
![version](https://img.shields.io/badge/version-0.2.2-blue)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

</div>
Expand Down
51 changes: 25 additions & 26 deletions tests/test_widgets.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from unittest.mock import patch
from unittest.mock import patch, Mock
import tkinter as tk

import src.widgets
from src.widgets import (
set_options,
PicklevwTkLoadButton,
Expand Down Expand Up @@ -53,30 +55,27 @@ def test_picklevw_tk_frame(mock_showerror):
finally:
root.destroy()

# @patch("tkinter.messagebox.showerror")
# def test_picklevw_tk_canvas(mock_showerror):
# root = tk.Tk()
# try:
# canvas = PicklevwTkCanvas(root)
# mock_text_widget = Mock()
# canvas.attach(mock_text_widget)
# assert canvas.textwidget == mock_text_widget
# canvas.redraw()
# mock_showerror.assert_not_called()
# finally:
# root.destroy()

@patch("tkinter.messagebox.showerror")
def test_picklevw_tk_canvas(mock_showerror):
root = tk.Tk()
try:
canvas = PicklevwTkCanvas(root)
mock_text_widget = Mock()
canvas.attach(mock_text_widget)
assert canvas.textwidget == mock_text_widget
mock_showerror.assert_not_called()
finally:
root.destroy()


# @patch("tkinter.messagebox.showerror")
# @patch("tkinter.Text.tk.call")
# def test_picklevw_tk_text(mock_tk_call, mock_showerror):
# root = tk.Tk()
# try:
# text = PicklevwTkText(root)
# assert text.cget("background") == "white"
# assert text.cget("foreground") == "black"
# mock_tk_call.assert_any_call("rename", text._w, text._orig)
# mock_tk_call.assert_any_call(text._w, text._proxy)
# finally:
# root.destroy()
# mock_showerror.assert_not_called()
@patch("tkinter.messagebox.showerror")
def test_picklevw_tk_text(mock_showerror):
root = tk.Tk()
try:
text = PicklevwTkText(root)
assert text.cget("background") == "white"
assert text.cget("foreground") == "black"
finally:
root.destroy()
mock_showerror.assert_not_called()

0 comments on commit 7cf0538

Please sign in to comment.