diff --git a/tests/data/sample.activity/activity.py b/tests/data/sample.activity/activity.py index 97d3c986..ea4e9836 100644 --- a/tests/data/sample.activity/activity.py +++ b/tests/data/sample.activity/activity.py @@ -2,6 +2,7 @@ from gettext import gettext as _ from sugar3.activity import activity + class SampleActivity(activity.Activity): def __init__(self, handle): activity.Activity.__init__(self, handle) diff --git a/tests/graphics/cellrendererprogress.py b/tests/graphics/cellrendererprogress.py index 4bfe9547..94c1b9a3 100644 --- a/tests/graphics/cellrendererprogress.py +++ b/tests/graphics/cellrendererprogress.py @@ -15,7 +15,10 @@ test = common.Test() test.show() model = Gtk.ListStore(str, int, int) -for item in [('one', 72, -1), ('two', 50, -1), ('three', 35, -1), ('four', 0, 5)]: +for item in [('one', 72, -1), + ('two', 50, -1), + ('three', 35, -1), + ('four', 0, 5)]: model.append(item) treeview = Gtk.TreeView() diff --git a/tests/test_bundlebuilder.py b/tests/test_bundlebuilder.py index 46a02a1d..e2f7f5dd 100644 --- a/tests/test_bundlebuilder.py +++ b/tests/test_bundlebuilder.py @@ -25,6 +25,7 @@ import zipfile tests_dir = os.path.dirname(__file__) data_dir = os.path.join(tests_dir, "data") + class TestGit(unittest.TestCase): _source_files = ["activity.py", "setup.py", @@ -41,7 +42,7 @@ class TestGit(unittest.TestCase): expected = self._share_locale_files[:] expected.extend(self._activity_locale_files) return expected - + def _create_repo(self): cwd = os.getcwd() path = tempfile.mkdtemp() @@ -140,7 +141,7 @@ class TestGit(unittest.TestCase): self.assertTrue(os.path.exists(activity_py_path)) os.chdir(cwd) - + def _test_genpot(self, source_path, build_path): cwd = os.getcwd() os.chdir(build_path) @@ -154,7 +155,7 @@ class TestGit(unittest.TestCase): self.assertTrue(os.path.exists(pot_path)) os.chdir(cwd) - + def _test_install(self, source_path, build_path): install_path = tempfile.mkdtemp() @@ -188,7 +189,7 @@ class TestGit(unittest.TestCase): self.assertItemsEqual(filenames, self._share_locale_files) os.chdir(cwd) - + def test_dist_xo_in_source(self): repo_path = self._create_repo() self._test_dist_xo(repo_path, repo_path) diff --git a/tests/test_mime.py b/tests/test_mime.py index 1f96046d..68fca5a2 100644 --- a/tests/test_mime.py +++ b/tests/test_mime.py @@ -25,6 +25,7 @@ from sugar3 import mime tests_dir = os.path.dirname(__file__) data_dir = os.path.join(tests_dir, "data") + class TestMime(unittest.TestCase): def test_split_uri_list(self): self.assertSequenceEqual(mime.split_uri_list("http://one\nhttp://two"), @@ -45,50 +46,60 @@ class TestMime(unittest.TestCase): def test_choose_most_significant(self): # Mozilla's text in dnd mime_type = mime.choose_most_significant( - ['text/plain', 'text/_moz_htmlcontext', 'text/unicode', - 'text/html', 'text/_moz_htmlinfo']) + ['text/plain', 'text/_moz_htmlcontext', 'text/unicode', + 'text/html', 'text/_moz_htmlinfo']) self.assertEqual(mime_type, 'text/html') # Mozilla's text in c&v mime_type = mime.choose_most_significant( - ['text/_moz_htmlcontext', 'STRING', 'text/html', - 'text/_moz_htmlinfo', 'text/x-moz-url-priv', 'UTF8_STRING', - 'COMPOUND_TEXT']) + ['text/_moz_htmlcontext', + 'STRING', + 'text/html', + 'text/_moz_htmlinfo', + 'text/x-moz-url-priv', + 'UTF8_STRING', + 'COMPOUND_TEXT']) self.assertEqual(mime_type, 'text/html') # Mozilla gif in dnd mime_type = mime.choose_most_significant( - ['application/x-moz-file-promise-url', - 'application/x-moz-file-promise-dest-filename', - 'text/_moz_htmlinfo', 'text/x-moz-url-desc', - 'text/_moz_htmlcontext', 'text/x-moz-url-data', - 'text/uri-list']) + ['application/x-moz-file-promise-url', + 'application/x-moz-file-promise-dest-filename', + 'text/_moz_htmlinfo', 'text/x-moz-url-desc', + 'text/_moz_htmlcontext', 'text/x-moz-url-data', + 'text/uri-list']) self.assertEqual(mime_type, 'text/uri-list') # Mozilla url in dnd mime_type = mime.choose_most_significant( - ['text/_moz_htmlcontext', 'text/html', 'text/_moz_htmlinfo', - '_NETSCAPE_URL', 'text/x-moz-url', 'text/x-moz-url-desc', - 'text/x-moz-url-data', 'text/plain', 'text/unicode']) + ['text/_moz_htmlcontext', + 'text/html', + 'text/_moz_htmlinfo', + '_NETSCAPE_URL', + 'text/x-moz-url', + 'text/x-moz-url-desc', + 'text/x-moz-url-data', + 'text/plain', + 'text/unicode']) self.assertEqual(mime_type, 'text/x-moz-url') # Abiword text in dnd mime_type = mime.choose_most_significant( - ['text/rtf', 'text/uri-list']) + ['text/rtf', 'text/uri-list']) self.assertEqual(mime_type, 'text/uri-list') # Abiword text in c&v mime_type = mime.choose_most_significant( - ['UTF8_STRING', 'STRING', 'text/html', 'TEXT', 'text/rtf', - 'COMPOUND_TEXT', 'application/rtf', 'text/plain', - 'application/xhtml+xml']) + ['UTF8_STRING', 'STRING', 'text/html', 'TEXT', 'text/rtf', + 'COMPOUND_TEXT', 'application/rtf', 'text/plain', + 'application/xhtml+xml']) self.assertEqual(mime_type, 'application/rtf') # Abiword text in c&v mime_type = mime.choose_most_significant( - ['GTK_TEXT_BUFFER_CONTENTS', - 'application/x-gtk-text-buffer-rich-text', - 'UTF8_STRING', 'COMPOUND_TEXT', 'TEXT', 'STRING', - 'text/plain;charset=utf-8', 'text/plain;charset=UTF-8', - 'text/plain']) + ['GTK_TEXT_BUFFER_CONTENTS', + 'application/x-gtk-text-buffer-rich-text', + 'UTF8_STRING', 'COMPOUND_TEXT', 'TEXT', 'STRING', + 'text/plain;charset=utf-8', 'text/plain;charset=UTF-8', + 'text/plain']) self.assertEqual(mime_type, 'text/plain') diff --git a/tests/test_uitree.py b/tests/test_uitree.py index 1104a433..9a3f63b1 100644 --- a/tests/test_uitree.py +++ b/tests/test_uitree.py @@ -20,6 +20,7 @@ import unittest from sugar3.test import uitree + class TestUITree(unittest.TestCase): def test_tree(self): process = subprocess.Popen(["python", __file__, "show_window1"]) @@ -33,6 +34,7 @@ class TestUITree(unittest.TestCase): self.assertIsNotNone(button) + def show_window1(): from gi.repository import Gtk