emmental/tests/test_entry.py

28 lines
940 B
Python
Raw Normal View History

# Copyright 2022 (c) Anna Schumaker.
"""Tests our custom Gtk.Entries."""
import unittest
import emmental.entry
from gi.repository import Gtk
class TestFilterEntry(unittest.TestCase):
"""Test our custom FilterEntry."""
def setUp(self):
"""Set up common variables."""
self.entry = emmental.entry.Filter(what="tests")
def test_init(self):
"""Test that the entry is configured correctly."""
self.assertIsInstance(self.entry, Gtk.SearchEntry)
self.assertEqual(self.entry.get_property("placeholder-text"),
"type to filter tests")
self.assertEqual(self.entry.get_placeholder_text(),
"type to filter tests")
def test_get_query(self):
"""Test the get_query() function."""
self.assertEqual(self.entry.get_query(), None)
self.entry.set_text("^test")
self.assertEqual(self.entry.get_query(), "test*")