1. Thomas Waldmann
  2. moin-2.0

Commits

Thomas Waldmann  committed 093bdc2

remove redundant parens, fix some minor bugs

  • Participants
  • Parent commits cb2ca94
  • Branches default

Comments (0)

Files changed (13)

File MoinMoin/_tests/test_wikiutil.py

View file
     # with no parent
     result = wikiutil.ParentItemName(u'itemname')
     expected = u''
-    assert result == expected, ('Expected "%(expected)s" but got "%(result)s"')
+    assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
     # with a parent
     result = wikiutil.ParentItemName(u'some/parent/itemname')
     expected = u'some/parent'

File MoinMoin/converter/html_out.py

View file
                                          html.onclick_:
                                             "$('.moin-table-of-contents ol').toggle();return false;",
                                      },
-                                     children=[('[+]'), ])
+                                     children=['[+]', ])
                 elem_h = html.div(attrib={html.class_: 'moin-table-of-contents-heading'},
                                   children=[_('Contents'), headtogglelink])
                 elem.append(elem_h)

File MoinMoin/converter/rst_in.py

View file
 
 class Writer(writers.Writer):
 
-    supported = ('moin-x-document')
+    supported = ('moin-x-document', )
     config_section = 'MoinMoin writer'
     config_section_dependencies = ('writers', )
     output = None

File MoinMoin/mail/sendmail.py

View file
     logging.debug("send mail, to: {0!r}".format(to))
 
     if not to and not cc and not bcc:
-        return (1, _("No recipients, nothing to do"))
+        return 1, _("No recipients, nothing to do")
 
     subject = subject.encode(CHARSET)
 
                     pass
         except smtplib.SMTPException as e:
             logging.exception("smtp mail failed with an exception.")
-            return (0, str(e))
+            return 0, str(e)
         except (os.error, socket.error) as e:
             logging.exception("smtp mail failed with an exception.")
             return (0, _("Connection to mailserver '%(server)s' failed: %(reason)s",
             sendmail_status = sendmailp.close()
             if sendmail_status:
                 logging.error("sendmail failed with status: {0!s}".format(sendmail_status))
-                return (0, str(sendmail_status))
+                return 0, str(sendmail_status)
         except:
             logging.exception("sendmail failed with an exception.")
-            return (0, _("Mail not sent"))
+            return 0, _("Mail not sent")
 
     logging.debug("Mail sent successfully")
-    return (1, _("Mail sent successfully"))
+    return 1, _("Mail sent successfully")
 
 
 def encodeSpamSafeEmail(email_address, obfuscation_text=''):

File MoinMoin/themes/_tests/test_navi_bar.py

View file
     def test_parent_item(self):
         test_result = ThemeSupport.parent_item(self.theme, 'moin/moin-2.0/Item')
         expected = 'moin/moin-2.0'
-        assert test_result == expected, ('Expected "%(expected)s" but got "%(test_result)s"') % locals()
+        assert test_result == expected, 'Expected "%(expected)s" but got "%(test_result)s"' % locals()
 
 
 def test_shorten_item_name():

File MoinMoin/user.py

View file
     if userid:
         userdata = User(userid)
         if userdata.mailto_author and userdata.email:
-            return ('email', userdata.email)
+            return 'email', userdata.email
         elif userdata.name:
             interwiki = getInterwikiHome(userdata.name0)
             if interwiki:

File MoinMoin/util/__init__.py

View file
     else:
         previous_offset = -1
     next_offset = count
-    return (selected_result, next_offset, previous_offset)
+    return selected_result, next_offset, previous_offset

File MoinMoin/util/_tests/test_crypto.py

View file
         length = 8
         result1 = crypto.random_string(length)
         result2 = crypto.random_string(length)
-        assert result1 != result2, ('Expected different random strings, but got "%(result1)s" and "%(result2)s"') % locals()
+        assert result1 != result2, 'Expected different random strings, but got "%(result1)s" and "%(result2)s"' % locals()
 
         result_string = crypto.random_string(length)
         assert isinstance(result_string, str), ('Expected an string value, but got ' + str(type(result_string)))
 
         result = len(crypto.random_string(length))
         expected = length
-        assert result == expected, ('Expected length "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected length "%(expected)s" but got "%(result)s"' % locals()
 
 
 class TestToken(object):
         result1 = crypto.cache_key(**test_kw1)
         test_kw2 = {'Moin2': 'value2'}
         result2 = crypto.cache_key(**test_kw2)
-        assert result1 != result2, ("Expected different keys for different <kw> but got the same")
+        assert result1 != result2, "Expected different keys for different <kw> but got the same"
 
 
 coverage_modules = ['MoinMoin.util.crypto']

File MoinMoin/util/_tests/test_diff3.py

View file
 AAA 014
 >>>>>>>>>>>>>>>>>>>>>>>>>
 """
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
 
 coverage_modules = ['MoinMoin.util.diff3']

File MoinMoin/util/_tests/test_diff_text.py

View file
 - AAA 013
 - AAA 014"""
 
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
 
 coverage_modules = ['MoinMoin.util.diff_text']

File MoinMoin/util/_tests/test_util.py

View file
         """ util.rangelist: test correct function for misc. input values """
         result = util.rangelist([])
         expected = ''
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
         result = util.rangelist([42])
         expected = '42'
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
         result = util.rangelist([42, 23])
         expected = '23,42'
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
         result = util.rangelist([1, 2, 3, 4, 5])
         expected = '1-5'
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
         result = util.rangelist([2, 5, 3])
         expected = '2-3,5'
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
         result = util.rangelist([2, 3, 5, 6])
         expected = '2-3,5-6'
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
         result = util.rangelist([2, 3, 5, 6, 23, 100, 101, 102, 104])
         expected = '2-3,5-6,23,100-102,104'
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
 
 coverage_modules = ['MoinMoin.util']

File MoinMoin/util/diff3.py

View file
             match_len = match(old, other, other_match[0], other_match[1],
                               difference)
             if match_len == difference:
-                return (new_match[0], other_match[1] + difference, new_match[1])
+                return new_match[0], other_match[1] + difference, new_match[1]
             else:
                 other_match = find_match(old, other,
                                          other_match[0] + match_len,
         # both conflicts change same number of lines
         # or no match till the end
         else:
-            return (new_match[0], other_match[1], new_match[1])
+            return new_match[0], other_match[1], new_match[1]
 
 
 def match(list1, list2, nr1, nr2, maxcount=3):
     elif hit2:
         return hit2
     else:
-        return (len1, len2)
+        return len1, len2
 
 
 def main():

File MoinMoin/util/paramparser.py

View file
                 return ret
         if self._defaultunit is not None:
             try:
-                return (self._type(s), self._defaultunit)
+                return self._type(s), self._defaultunit
             except ValueError:
                 pass
         units = ', '.join(self._units)