summaryrefslogtreecommitdiffstats
path: root/tests/test_option.py
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-07-26 08:46:07 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-07-26 08:46:07 +0000
commit7079b546e06dd77b61cd1ba4692a077a85b9e033 (patch)
treeb505c4318cc8b5c7eed6251e0a008de42e0113e7 /tests/test_option.py
parentb94d79214498b07abc22e676897c8314cc386c7c (diff)
downloadpygobject-7079b546e06dd77b61cd1ba4692a077a85b9e033.tar.gz
pygobject-7079b546e06dd77b61cd1ba4692a077a85b9e033.tar.xz
pygobject-7079b546e06dd77b61cd1ba4692a077a85b9e033.zip
Run pyflakes on the testsuite, remove unused imports and reorganize
2008-07-26 Johan Dahlin <johan@gnome.org> * tests/common.py: * tests/test_conversion.py: * tests/test_enum.py: * tests/test_interface.py: * tests/test_option.py: * tests/test_source.py: * tests/test_subprocess.py: * tests/test_subtype.py: * tests/test_thread.py: * tests/test_unknown.py: Run pyflakes on the testsuite, remove unused imports and reorganize others. svn path=/trunk/; revision=859
Diffstat (limited to 'tests/test_option.py')
-rw-r--r--tests/test_option.py22
1 files changed, 10 insertions, 12 deletions
diff --git a/tests/test_option.py b/tests/test_option.py
index 988ce52..dcafc0a 100644
--- a/tests/test_option.py
+++ b/tests/test_option.py
@@ -1,20 +1,18 @@
#!/usr/bin/env python
-import optparse
import unittest
import sys
from StringIO import StringIO
-from gobject import option
-
-from common import gobject
+from gobject.option import OptionParser, OptionGroup, OptionValueError, \
+ make_option, BadOptionError
class TestOption(unittest.TestCase):
EXCEPTION_MESSAGE = "This callback fails"
def setUp(self):
- self.parser = option.OptionParser("NAMES...",
+ self.parser = OptionParser("NAMES...",
description="Option unit test")
self.parser.add_option("-t", "--test", help="Unit test option",
action="store_false", dest="test", default=True)
@@ -27,18 +25,18 @@ class TestOption(unittest.TestCase):
def option_callback(option, opt, value, parser):
raise StandardError(self.EXCEPTION_MESSAGE)
- group = option.OptionGroup(
+ group = OptionGroup(
"unittest", "Unit test options", "Show all unittest options",
option_list = [
- option.make_option("-f", "-u", "--file", "--unit-file",
+ make_option("-f", "-u", "--file", "--unit-file",
type="filename",
dest="unit_file",
help="Unit test option"),
- option.make_option("--test-integer",
+ make_option("--test-integer",
type="int",
dest="test_integer",
help="Unit integer option"),
- option.make_option("--callback-failure-test",
+ make_option("--callback-failure-test",
action="callback",
callback=option_callback,
dest="test_integer",
@@ -89,16 +87,16 @@ class TestOption(unittest.TestCase):
def testOptionValueError(self):
self._create_group()
- self.assertRaises(option.OptionValueError, self.parser.parse_args,
+ self.assertRaises(OptionValueError, self.parser.parse_args,
["test_option.py", "--test-integer=text"])
def testBadOptionError(self):
- self.assertRaises(option.BadOptionError,
+ self.assertRaises(BadOptionError,
self.parser.parse_args,
["test_option.py", "--unknwon-option"])
def testOptionGroupConstructor(self):
- self.assertRaises(TypeError, option.OptionGroup)
+ self.assertRaises(TypeError, OptionGroup)
def testStandardError(self):
self._create_group()