-
-
Notifications
You must be signed in to change notification settings - Fork 216
/
Copy pathtest_plugin_tkcalendar.py
58 lines (45 loc) · 1.49 KB
/
test_plugin_tkcalendar.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# encoding: utf-8
import os
import sys
import unittest
import tkinter as tk
import tkinter.ttk as ttk
import fixpath
import pygubu
import support
from unittest.case import SkipTest
has_tkcalendar = True
try:
from tkcalendar import Calendar, DateEntry
except ImportError:
has_tkcalendar = False
class TestTkcalendarCalendar(unittest.TestCase):
def setUp(self):
if not has_tkcalendar:
raise SkipTest("tkcalendar not installed")
support.root_deiconify()
xmldata = "test_plugin_tkcalendar.ui"
self.builder = builder = pygubu.Builder()
builder.add_from_file(xmldata)
self.widget = builder.get_object("frame1")
self.calendar = builder.get_object("calendar")
def tearDown(self):
support.root_withdraw()
def test_class(self):
self.assertIsInstance(self.calendar, Calendar)
self.widget.destroy()
class TestTkcalendarDateEntry(unittest.TestCase):
def setUp(self):
if not has_tkcalendar:
raise SkipTest("tkcalendar not installed")
support.root_deiconify()
xmldata = "test_plugin_tkcalendar.ui"
self.builder = builder = pygubu.Builder()
builder.add_from_file(xmldata)
self.widget = builder.get_object("frame2")
self.entry = builder.get_object("dateentry")
def tearDown(self):
support.root_withdraw()
def test_class(self):
self.assertIsInstance(self.entry, DateEntry)
self.widget.destroy()