Rev 4886: (vila) Cleanup some test imports in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Dec 10 16:47:25 GMT 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4886 [merge]
revision-id: pqm at pqm.ubuntu.com-20091210164716-e18k2to740e9eq7s
parent: pqm at pqm.ubuntu.com-20091210153844-efqie2ybl6owgojv
parent: v.ladeuil+lp at free.fr-20091210154021-pebholf096haobyo
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-12-10 16:47:16 +0000
message:
  (vila) Cleanup some test imports
modified:
  bzrlib/tests/test_conflicts.py test_conflicts.py-20051006031059-e2dad9bbeaa5891f
  bzrlib/tests/test_ui.py        test_ui.py-20051130162854-458e667a7414af09
=== modified file 'bzrlib/tests/test_conflicts.py'
--- a/bzrlib/tests/test_conflicts.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/test_conflicts.py	2009-12-10 15:10:36 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005 Canonical Ltd
+# Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -17,24 +17,14 @@
 
 import os
 
-from bzrlib import bzrdir
-from bzrlib.tests import TestCaseWithTransport, TestCase
-from bzrlib.branch import Branch
-from bzrlib.conflicts import (
-    ConflictList,
-    ContentsConflict,
-    DuplicateID,
-    DuplicateEntry,
-    MissingParent,
-    NonDirectoryParent,
-    ParentLoop,
-    PathConflict,
-    TextConflict,
-    UnversionedParent,
-    resolve,
-    restore,
+from bzrlib import (
+    bzrdir,
+    conflicts,
+    errors,
+    tests,
+    workingtree,
     )
-from bzrlib.errors import NotConflicted
+from bzrlib.tests import script
 
 
 # TODO: Test commit with some added, and added-but-missing files
@@ -44,107 +34,118 @@
 # be a sorted list.
 # u'\xe5' == a with circle
 # '\xc3\xae' == u'\xee' == i with hat
-# So these are u'pathg' and 'idg' only with a circle and a hat. (shappo?)
-example_conflicts = ConflictList([
-    MissingParent('Not deleting', u'p\xe5thg', '\xc3\xaedg'),
-    ContentsConflict(u'p\xe5tha', None, '\xc3\xaeda'),
-    TextConflict(u'p\xe5tha'),
-    PathConflict(u'p\xe5thb', u'p\xe5thc', '\xc3\xaedb'),
-    DuplicateID('Unversioned existing file', u'p\xe5thc', u'p\xe5thc2',
-                '\xc3\xaedc', '\xc3\xaedc'),
-    DuplicateEntry('Moved existing file to',  u'p\xe5thdd.moved', u'p\xe5thd',
-                   '\xc3\xaedd', None),
-    ParentLoop('Cancelled move', u'p\xe5the', u'p\xe5th2e',
-               None, '\xc3\xaed2e'),
-    UnversionedParent('Versioned directory', u'p\xe5thf', '\xc3\xaedf'),
-    NonDirectoryParent('Created directory', u'p\xe5thg', '\xc3\xaedg'),
+# So these are u'path' and 'id' only with a circle and a hat. (shappo?)
+example_conflicts = conflicts.ConflictList(
+    [conflicts.MissingParent('Not deleting', u'p\xe5thg', '\xc3\xaedg'),
+     conflicts.ContentsConflict(u'p\xe5tha', None, '\xc3\xaeda'),
+     conflicts.TextConflict(u'p\xe5tha'),
+     conflicts.PathConflict(u'p\xe5thb', u'p\xe5thc', '\xc3\xaedb'),
+     conflicts.DuplicateID('Unversioned existing file',
+                           u'p\xe5thc', u'p\xe5thc2',
+                           '\xc3\xaedc', '\xc3\xaedc'),
+    conflicts.DuplicateEntry('Moved existing file to',
+                             u'p\xe5thdd.moved', u'p\xe5thd',
+                             '\xc3\xaedd', None),
+    conflicts.ParentLoop('Cancelled move', u'p\xe5the', u'p\xe5th2e',
+                         None, '\xc3\xaed2e'),
+    conflicts.UnversionedParent('Versioned directory',
+                                u'p\xe5thf', '\xc3\xaedf'),
+    conflicts.NonDirectoryParent('Created directory',
+                                 u'p\xe5thg', '\xc3\xaedg'),
 ])
 
 
-class TestConflicts(TestCaseWithTransport):
+class TestConflicts(tests.TestCaseWithTransport):
 
     def test_conflicts(self):
         """Conflicts are detected properly"""
-        tree = self.make_branch_and_tree('.',
-            format=bzrdir.BzrDirFormat6())
-        b = tree.branch
-        file('hello', 'w').write('hello world4')
-        file('hello.THIS', 'w').write('hello world2')
-        file('hello.BASE', 'w').write('hello world1')
-        file('hello.OTHER', 'w').write('hello world3')
-        file('hello.sploo.BASE', 'w').write('yellow world')
-        file('hello.sploo.OTHER', 'w').write('yellow world2')
+        # Use BzrDirFormat6 so we can fake conflicts
+        tree = self.make_branch_and_tree('.', format=bzrdir.BzrDirFormat6())
+        self.build_tree_contents([('hello', 'hello world4'),
+                                  ('hello.THIS', 'hello world2'),
+                                  ('hello.BASE', 'hello world1'),
+                                  ('hello.OTHER', 'hello world3'),
+                                  ('hello.sploo.BASE', 'yellowworld'),
+                                  ('hello.sploo.OTHER', 'yellowworld2'),
+                                  ])
         tree.lock_read()
-        self.assertEqual(len(list(tree.list_files())), 6)
+        self.assertEqual(6, len(list(tree.list_files())))
         tree.unlock()
-        conflicts = tree.conflicts()
-        self.assertEqual(len(conflicts), 2)
-        self.assert_('hello' in conflicts[0].path)
-        self.assert_('hello.sploo' in conflicts[1].path)
-        restore('hello')
-        restore('hello.sploo')
-        self.assertEqual(len(tree.conflicts()), 0)
+        tree_conflicts = tree.conflicts()
+        self.assertEqual(2, len(tree_conflicts))
+        self.assertTrue('hello' in tree_conflicts[0].path)
+        self.assertTrue('hello.sploo' in tree_conflicts[1].path)
+        conflicts.restore('hello')
+        conflicts.restore('hello.sploo')
+        self.assertEqual(0, len(tree.conflicts()))
         self.assertFileEqual('hello world2', 'hello')
         self.assertFalse(os.path.lexists('hello.sploo'))
-        self.assertRaises(NotConflicted, restore, 'hello')
-        self.assertRaises(NotConflicted, restore, 'hello.sploo')
+        self.assertRaises(errors.NotConflicted, conflicts.restore, 'hello')
+        self.assertRaises(errors.NotConflicted,
+                          conflicts.restore, 'hello.sploo')
 
     def test_resolve_conflict_dir(self):
         tree = self.make_branch_and_tree('.')
-        b = tree.branch
-        file('hello', 'w').write('hello world4')
+        self.build_tree_contents([('hello', 'hello world4'),
+                                  ('hello.THIS', 'hello world2'),
+                                  ('hello.BASE', 'hello world1'),
+                                  ])
+        os.mkdir('hello.OTHER')
         tree.add('hello', 'q')
-        file('hello.THIS', 'w').write('hello world2')
-        file('hello.BASE', 'w').write('hello world1')
-        os.mkdir('hello.OTHER')
-        l = ConflictList([TextConflict('hello')])
+        l = conflicts.ConflictList([conflicts.TextConflict('hello')])
         l.remove_files(tree)
 
     def test_select_conflicts(self):
         tree = self.make_branch_and_tree('.')
-        tree_conflicts = ConflictList([ContentsConflict('foo'),
-                                       ContentsConflict('bar')])
-        self.assertEqual((ConflictList([ContentsConflict('bar')]),
-                          ConflictList([ContentsConflict('foo')])),
-                         tree_conflicts.select_conflicts(tree, ['foo']))
-        self.assertEqual((ConflictList(), tree_conflicts),
-                         tree_conflicts.select_conflicts(tree, [''],
-                         ignore_misses=True, recurse=True))
-        tree_conflicts = ConflictList([ContentsConflict('foo/baz'),
-                                       ContentsConflict('bar')])
-        self.assertEqual((ConflictList([ContentsConflict('bar')]),
-                          ConflictList([ContentsConflict('foo/baz')])),
-                         tree_conflicts.select_conflicts(tree, ['foo'],
-                                                         recurse=True,
-                                                         ignore_misses=True))
-        tree_conflicts = ConflictList([PathConflict('qux', 'foo/baz')])
-        self.assertEqual((ConflictList(), tree_conflicts),
-                         tree_conflicts.select_conflicts(tree, ['foo'],
-                                                         recurse=True,
-                                                         ignore_misses=True))
-        self.assertEqual((tree_conflicts, ConflictList()),
-                         tree_conflicts.select_conflicts(tree, ['foo'],
-                                                         ignore_misses=True))
+        clist = conflicts.ConflictList
+
+        def check_select(not_selected, selected, paths, **kwargs):
+            self.assertEqual(
+                (not_selected, selected),
+                tree_conflicts.select_conflicts(tree, paths, **kwargs))
+
+        foo = conflicts.ContentsConflict('foo')
+        bar = conflicts.ContentsConflict('bar')
+        tree_conflicts = clist([foo, bar])
+
+        check_select(clist([bar]), clist([foo]), ['foo'])
+        check_select(clist(), tree_conflicts,
+                     [''], ignore_misses=True, recurse=True)
+
+        foobaz  = conflicts.ContentsConflict('foo/baz')
+        tree_conflicts = clist([foobaz, bar])
+
+        check_select(clist([bar]), clist([foobaz]),
+                     ['foo'], ignore_misses=True, recurse=True)
+
+        qux = conflicts.PathConflict('qux', 'foo/baz')
+        tree_conflicts = clist([qux])
+
+        check_select(clist(), tree_conflicts,
+                     ['foo'], ignore_misses=True, recurse=True)
+        check_select (tree_conflicts, clist(), ['foo'], ignore_misses=True)
 
     def test_resolve_conflicts_recursive(self):
         tree = self.make_branch_and_tree('.')
         self.build_tree(['dir/', 'dir/hello'])
         tree.add(['dir', 'dir/hello'])
-        tree.set_conflicts(ConflictList([TextConflict('dir/hello')]))
-        resolve(tree, ['dir'], recursive=False, ignore_misses=True)
-        self.assertEqual(ConflictList([TextConflict('dir/hello')]),
-                         tree.conflicts())
-        resolve(tree, ['dir'], recursive=True, ignore_misses=True)
-        self.assertEqual(ConflictList([]),
-                         tree.conflicts())
-
-
-class TestConflictStanzas(TestCase):
+
+        dirhello = conflicts.ConflictList([conflicts.TextConflict('dir/hello')])
+        tree.set_conflicts(dirhello)
+
+        conflicts.resolve(tree, ['dir'], recursive=False, ignore_misses=True)
+        self.assertEqual(dirhello, tree.conflicts())
+
+        conflicts.resolve(tree, ['dir'], recursive=True, ignore_misses=True)
+        self.assertEqual(conflicts.ConflictList([]), tree.conflicts())
+
+
+class TestConflictStanzas(tests.TestCase):
 
     def test_stanza_roundtrip(self):
         # write and read our example stanza.
         stanza_iter = example_conflicts.to_stanzas()
-        processed = ConflictList.from_stanzas(stanza_iter)
+        processed = conflicts.ConflictList.from_stanzas(stanza_iter)
         for o, p in zip(processed, example_conflicts):
             self.assertEqual(o, p)
 
@@ -171,3 +172,4 @@
                 self.assertStartsWith(stanza['conflict_path'], u'p\xe5th')
             if 'conflict_file_id' in stanza:
                 self.assertStartsWith(stanza['conflict_file_id'], u'\xeed')
+

=== modified file 'bzrlib/tests/test_ui.py'
--- a/bzrlib/tests/test_ui.py	2009-11-16 02:56:34 +0000
+++ b/bzrlib/tests/test_ui.py	2009-12-10 15:40:21 +0000
@@ -18,9 +18,7 @@
 """
 
 import os
-from StringIO import StringIO
 import re
-import sys
 import time
 
 from bzrlib import (
@@ -31,27 +29,8 @@
 from bzrlib.symbol_versioning import (
     deprecated_in,
     )
-from bzrlib.tests import (
-    TestCase,
-    TestUIFactory,
-    StringIOWrapper,
-    )
-from bzrlib.tests.test_progress import (
-    _NonTTYStringIO,
-    _TTYStringIO,
-    )
-from bzrlib.ui import (
-    CannedInputUIFactory,
-    SilentUIFactory,
-    UIFactory,
-    make_ui_for_terminal,
-    )
-from bzrlib.ui.text import (
-    NullProgressView,
-    TextProgressView,
-    TextUIFactory,
-    TextUIOutputStream,
-    )
+from bzrlib.tests import test_progress
+from bzrlib.ui import text as _mod_ui_text
 
 
 class TestTextUIFactory(tests.TestCase):
@@ -101,11 +80,11 @@
             pb.finished()
 
     def test_progress_note(self):
-        stderr = StringIO()
-        stdout = StringIO()
-        ui_factory = TextUIFactory(stdin=StringIO(''),
-            stderr=stderr,
-            stdout=stdout)
+        stderr = tests.StringIOWrapper()
+        stdout = tests.StringIOWrapper()
+        ui_factory = _mod_ui_text.TextUIFactory(stdin=tests.StringIOWrapper(''),
+                                                stderr=stderr,
+                                                stdout=stdout)
         pb = ui_factory.nested_progress_bar()
         try:
             result = self.applyDeprecated(deprecated_in((2, 1, 0)),
@@ -121,15 +100,15 @@
             pb.finished()
 
     def test_progress_note_clears(self):
-        stderr = _TTYStringIO()
-        stdout = _TTYStringIO()
+        stderr = test_progress._TTYStringIO()
+        stdout = test_progress._TTYStringIO()
         # so that we get a TextProgressBar
         os.environ['TERM'] = 'xterm'
-        ui_factory = TextUIFactory(
-            stdin=StringIO(''),
+        ui_factory = _mod_ui_text.TextUIFactory(
+            stdin=tests.StringIOWrapper(''),
             stdout=stdout, stderr=stderr)
         self.assertIsInstance(ui_factory._progress_view,
-            TextProgressView)
+                              _mod_ui_text.TextProgressView)
         pb = ui_factory.nested_progress_bar()
         try:
             # Create a progress update that isn't throttled
@@ -147,7 +126,7 @@
 
     def test_progress_nested(self):
         # test factory based nested and popping.
-        ui = TextUIFactory(None, None, None)
+        ui = _mod_ui_text.TextUIFactory(None, None, None)
         pb1 = ui.nested_progress_bar()
         pb2 = ui.nested_progress_bar()
         # You do get a warning if the outermost progress bar wasn't finished
@@ -160,16 +139,16 @@
         pb1.finished()
 
     def test_text_ui_get_boolean(self):
-        stdin = StringIO("y\n" # True
-                         "n\n" # False
-                         "yes with garbage\nY\n" # True
-                         "not an answer\nno\n" # False
-                         "I'm sure!\nyes\n" # True
-                         "NO\n" # False
-                         "foo\n")
-        stdout = StringIO()
-        stderr = StringIO()
-        factory = TextUIFactory(stdin, stdout, stderr)
+        stdin = tests.StringIOWrapper("y\n" # True
+                                      "n\n" # False
+                                      "yes with garbage\nY\n" # True
+                                      "not an answer\nno\n" # False
+                                      "I'm sure!\nyes\n" # True
+                                      "NO\n" # False
+                                      "foo\n")
+        stdout = tests.StringIOWrapper()
+        stderr = tests.StringIOWrapper()
+        factory = _mod_ui_text.TextUIFactory(stdin, stdout, stderr)
         self.assertEqual(True, factory.get_boolean(""))
         self.assertEqual(False, factory.get_boolean(""))
         self.assertEqual(True, factory.get_boolean(""))
@@ -182,16 +161,19 @@
 
     def test_text_factory_prompt(self):
         # see <https://launchpad.net/bugs/365891>
-        factory = TextUIFactory(StringIO(), StringIO(), StringIO())
+        StringIO = tests.StringIOWrapper
+        factory = _mod_ui_text.TextUIFactory(StringIO(), StringIO(), StringIO())
         factory.prompt('foo %2e')
         self.assertEqual('', factory.stdout.getvalue())
         self.assertEqual('foo %2e', factory.stderr.getvalue())
 
     def test_text_factory_prompts_and_clears(self):
         # a get_boolean call should clear the pb before prompting
-        out = _TTYStringIO()
+        out = test_progress._TTYStringIO()
         os.environ['TERM'] = 'xterm'
-        factory = TextUIFactory(stdin=StringIO("yada\ny\n"), stdout=out, stderr=out)
+        factory = _mod_ui_text.TextUIFactory(
+            stdin=tests.StringIOWrapper("yada\ny\n"),
+            stdout=out, stderr=out)
         pb = factory.nested_progress_bar()
         pb.show_bar = False
         pb.show_spinner = False
@@ -211,7 +193,8 @@
         self.assertEqual('', factory.stdin.readline())
 
     def test_text_tick_after_update(self):
-        ui_factory = TextUIFactory(stdout=StringIO(), stderr=StringIO())
+        ui_factory = _mod_ui_text.TextUIFactory(stdout=tests.StringIOWrapper(),
+                                                stderr=tests.StringIOWrapper())
         pb = ui_factory.nested_progress_bar()
         try:
             pb.update('task', 0, 3)
@@ -222,10 +205,10 @@
             pb.finished()
 
     def test_text_ui_getusername(self):
-        factory = TextUIFactory(None, None, None)
-        factory.stdin = StringIO("someuser\n\n")
-        factory.stdout = StringIO()
-        factory.stderr = StringIO()
+        factory = _mod_ui_text.TextUIFactory(None, None, None)
+        factory.stdin = tests.StringIOWrapper("someuser\n\n")
+        factory.stdout = tests.StringIOWrapper()
+        factory.stderr = tests.StringIOWrapper()
         factory.stdout.encoding = "utf8"
         # there is no output from the base factory
         self.assertEqual("someuser",
@@ -254,22 +237,22 @@
             pb.finished()
 
 
-class TestTextUIOutputStream(TestCase):
+class TestTextUIOutputStream(tests.TestCase):
     """Tests for output stream that synchronizes with progress bar."""
 
     def test_output_clears_terminal(self):
-        stdout = StringIO()
-        stderr = StringIO()
+        stdout = tests.StringIOWrapper()
+        stderr = tests.StringIOWrapper()
         clear_calls = []
 
-        uif = TextUIFactory(None, stdout, stderr)
+        uif =  _mod_ui_text.TextUIFactory(None, stdout, stderr)
         uif.clear_term = lambda: clear_calls.append('clear')
 
-        stream = TextUIOutputStream(uif, uif.stdout)
+        stream = _mod_ui_text.TextUIOutputStream(uif, uif.stdout)
         stream.write("Hello world!\n")
         stream.write("there's more...\n")
         stream.writelines(["1\n", "2\n", "3\n"])
-        
+
         self.assertEqual(stdout.getvalue(),
             "Hello world!\n"
             "there's more...\n"
@@ -285,22 +268,24 @@
     def test_progress_construction(self):
         """TextUIFactory constructs the right progress view.
         """
+        TTYStringIO = test_progress._TTYStringIO
+        FileStringIO = tests.StringIOWrapper
         for (file_class, term, pb, expected_pb_class) in (
             # on an xterm, either use them or not as the user requests,
             # otherwise default on
-            (_TTYStringIO, 'xterm', 'none', NullProgressView),
-            (_TTYStringIO, 'xterm', 'text', TextProgressView),
-            (_TTYStringIO, 'xterm', None, TextProgressView),
+            (TTYStringIO, 'xterm', 'none', _mod_ui_text.NullProgressView),
+            (TTYStringIO, 'xterm', 'text', _mod_ui_text.TextProgressView),
+            (TTYStringIO, 'xterm', None, _mod_ui_text.TextProgressView),
             # on a dumb terminal, again if there's explicit configuration do
             # it, otherwise default off
-            (_TTYStringIO, 'dumb', 'none', NullProgressView),
-            (_TTYStringIO, 'dumb', 'text', TextProgressView),
-            (_TTYStringIO, 'dumb', None, NullProgressView),
+            (TTYStringIO, 'dumb', 'none', _mod_ui_text.NullProgressView),
+            (TTYStringIO, 'dumb', 'text', _mod_ui_text.TextProgressView),
+            (TTYStringIO, 'dumb', None, _mod_ui_text.NullProgressView),
             # on a non-tty terminal, it's null regardless of $TERM
-            (StringIO, 'xterm', None, NullProgressView),
-            (StringIO, 'dumb', None, NullProgressView),
+            (FileStringIO, 'xterm', None, _mod_ui_text.NullProgressView),
+            (FileStringIO, 'dumb', None, _mod_ui_text.NullProgressView),
             # however, it can still be forced on
-            (StringIO, 'dumb', 'text', TextProgressView),
+            (FileStringIO, 'dumb', 'text', _mod_ui_text.TextProgressView),
             ):
             os.environ['TERM'] = term
             if pb is None:
@@ -311,8 +296,8 @@
             stdin = file_class('')
             stderr = file_class()
             stdout = file_class()
-            uif = make_ui_for_terminal(stdin, stdout, stderr)
-            self.assertIsInstance(uif, TextUIFactory,
+            uif = _mod_ui.make_ui_for_terminal(stdin, stdout, stderr)
+            self.assertIsInstance(uif, _mod_ui_text.TextUIFactory,
                 "TERM=%s BZR_PROGRESS_BAR=%s uif=%r" % (term, pb, uif,))
             self.assertIsInstance(uif.make_progress_view(),
                 expected_pb_class,
@@ -320,27 +305,27 @@
 
     def test_text_ui_non_terminal(self):
         """Even on non-ttys, make_ui_for_terminal gives a text ui."""
-        stdin = _NonTTYStringIO('')
-        stderr = _NonTTYStringIO()
-        stdout = _NonTTYStringIO()
+        stdin = test_progress._NonTTYStringIO('')
+        stderr = test_progress._NonTTYStringIO()
+        stdout = test_progress._NonTTYStringIO()
         for term_type in ['dumb', None, 'xterm']:
             if term_type is None:
                 del os.environ['TERM']
             else:
                 os.environ['TERM'] = term_type
-            uif = make_ui_for_terminal(stdin, stdout, stderr)
-            self.assertIsInstance(uif, TextUIFactory,
+            uif = _mod_ui.make_ui_for_terminal(stdin, stdout, stderr)
+            self.assertIsInstance(uif, _mod_ui_text.TextUIFactory,
                 'TERM=%r' % (term_type,))
 
 
-class SilentUITests(TestCase):
+class SilentUITests(tests.TestCase):
 
     def test_silent_factory_get_password(self):
         # A silent factory that can't do user interaction can't get a
         # password.  Possibly it should raise a more specific error but it
         # can't succeed.
-        ui = SilentUIFactory()
-        stdout = StringIO()
+        ui = _mod_ui.SilentUIFactory()
+        stdout = tests.StringIOWrapper()
         self.assertRaises(
             NotImplementedError,
             self.apply_redirected,
@@ -349,34 +334,35 @@
         self.assertEqual('', stdout.getvalue())
 
     def test_silent_ui_getbool(self):
-        factory = SilentUIFactory()
-        stdout = StringIO()
+        factory = _mod_ui.SilentUIFactory()
+        stdout = tests.StringIOWrapper()
         self.assertRaises(
             NotImplementedError,
             self.apply_redirected,
             None, stdout, stdout, factory.get_boolean, "foo")
 
 
-class TestUIFactoryTests(TestCase):
+class TestUIFactoryTests(tests.TestCase):
 
     def test_test_ui_factory_progress(self):
         # there's no output; we just want to make sure this doesn't crash -
         # see https://bugs.edge.launchpad.net/bzr/+bug/408201
-        ui = TestUIFactory()
+        ui = tests.TestUIFactory()
         pb = ui.nested_progress_bar()
         pb.update('hello')
         pb.tick()
         pb.finished()
 
 
-class CannedInputUIFactoryTests(TestCase):
-    
+class CannedInputUIFactoryTests(tests.TestCase):
+
     def test_canned_input_get_input(self):
-        uif = CannedInputUIFactory([True, 'mbp', 'password'])
-        self.assertEqual(uif.get_boolean('Extra cheese?'), True)
-        self.assertEqual(uif.get_username('Enter your user name'), 'mbp')
-        self.assertEqual(uif.get_password('Password for %(host)s', host='example.com'),
-            'password')
+        uif = _mod_ui.CannedInputUIFactory([True, 'mbp', 'password', 42])
+        self.assertEqual(True, uif.get_boolean('Extra cheese?'))
+        self.assertEqual('mbp', uif.get_username('Enter your user name'))
+        self.assertEqual('password',
+                         uif.get_password('Password for %(host)s',
+                                          host='example.com'))
 
 
 class TestBoolFromString(tests.TestCase):




More information about the bazaar-commits mailing list