pep8'd tests

This commit is contained in:
William Orr 2013-05-17 22:52:03 -04:00 committed by Daniel Narvaez
parent 30acc63d51
commit b9e17f640e
5 changed files with 45 additions and 27 deletions

View File

@ -2,6 +2,7 @@ from gettext import gettext as _
from sugar3.activity import activity from sugar3.activity import activity
class SampleActivity(activity.Activity): class SampleActivity(activity.Activity):
def __init__(self, handle): def __init__(self, handle):
activity.Activity.__init__(self, handle) activity.Activity.__init__(self, handle)

View File

@ -15,7 +15,10 @@ test = common.Test()
test.show() test.show()
model = Gtk.ListStore(str, int, int) 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) model.append(item)
treeview = Gtk.TreeView() treeview = Gtk.TreeView()

View File

@ -25,6 +25,7 @@ import zipfile
tests_dir = os.path.dirname(__file__) tests_dir = os.path.dirname(__file__)
data_dir = os.path.join(tests_dir, "data") data_dir = os.path.join(tests_dir, "data")
class TestGit(unittest.TestCase): class TestGit(unittest.TestCase):
_source_files = ["activity.py", _source_files = ["activity.py",
"setup.py", "setup.py",

View File

@ -25,6 +25,7 @@ from sugar3 import mime
tests_dir = os.path.dirname(__file__) tests_dir = os.path.dirname(__file__)
data_dir = os.path.join(tests_dir, "data") data_dir = os.path.join(tests_dir, "data")
class TestMime(unittest.TestCase): class TestMime(unittest.TestCase):
def test_split_uri_list(self): def test_split_uri_list(self):
self.assertSequenceEqual(mime.split_uri_list("http://one\nhttp://two"), self.assertSequenceEqual(mime.split_uri_list("http://one\nhttp://two"),
@ -51,8 +52,12 @@ class TestMime(unittest.TestCase):
# Mozilla's text in c&v # Mozilla's text in c&v
mime_type = mime.choose_most_significant( mime_type = mime.choose_most_significant(
['text/_moz_htmlcontext', 'STRING', 'text/html', ['text/_moz_htmlcontext',
'text/_moz_htmlinfo', 'text/x-moz-url-priv', 'UTF8_STRING', 'STRING',
'text/html',
'text/_moz_htmlinfo',
'text/x-moz-url-priv',
'UTF8_STRING',
'COMPOUND_TEXT']) 'COMPOUND_TEXT'])
self.assertEqual(mime_type, 'text/html') self.assertEqual(mime_type, 'text/html')
@ -67,9 +72,15 @@ class TestMime(unittest.TestCase):
# Mozilla url in dnd # Mozilla url in dnd
mime_type = mime.choose_most_significant( mime_type = mime.choose_most_significant(
['text/_moz_htmlcontext', 'text/html', 'text/_moz_htmlinfo', ['text/_moz_htmlcontext',
'_NETSCAPE_URL', 'text/x-moz-url', 'text/x-moz-url-desc', 'text/html',
'text/x-moz-url-data', 'text/plain', 'text/unicode']) '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') self.assertEqual(mime_type, 'text/x-moz-url')
# Abiword text in dnd # Abiword text in dnd

View File

@ -20,6 +20,7 @@ import unittest
from sugar3.test import uitree from sugar3.test import uitree
class TestUITree(unittest.TestCase): class TestUITree(unittest.TestCase):
def test_tree(self): def test_tree(self):
process = subprocess.Popen(["python", __file__, "show_window1"]) process = subprocess.Popen(["python", __file__, "show_window1"])
@ -33,6 +34,7 @@ class TestUITree(unittest.TestCase):
self.assertIsNotNone(button) self.assertIsNotNone(button)
def show_window1(): def show_window1():
from gi.repository import Gtk from gi.repository import Gtk