Thomas Waldmann avatar Thomas Waldmann committed 181a556

pep8 fixed for the tests

Comments (0)

Files changed (79)

MoinMoin/_tests/ldap_testbase.py

 import hashlib
 
 try:
-    import ldap, ldif, ldap.modlist  # needs python-ldap
+    # needs python-ldap
+    import ldap
+    import ldap.modlist
+    import ldif
 except ImportError:
     ldap = None
 

MoinMoin/_tests/test_error.py

         err = error.Error(test)
         assert '%(message)s' % dict(message=err) == test
 
+
 class TestCompositeError(object):
 
     def setup_method(self, method):
         expected = ['This is a fatal Error']
         assert result == expected
 
+
 coverage_modules = ['MoinMoin.error']

MoinMoin/_tests/test_forms.py

 
 from MoinMoin.forms import DateTimeUNIX
 
+
 def test_datetimeunix():
     dt = datetime.datetime(2012, 12, 21, 23, 45, 59)
     timestamp = timegm(dt.timetuple())

MoinMoin/_tests/test_test_environ.py

 
 from MoinMoin._tests import wikiconfig
 
+
 class TestStorageEnvironWithoutConfig(object):
     def setup_method(self, method):
         self.class_level_value = 123
 
 
 CONTENT_ACL = dict(
-        before="+All:write", # need to write to sys pages
+        before="+All:write",  # need to write to sys pages
         default="All:read,write,admin,create,destroy",
         after="Me:create",
         hierarchic=False,
 )
 
+
 class TestStorageEnvironWithConfig(object):
 
     class Config(wikiconfig.Config):

MoinMoin/_tests/test_user.py

 # -*- coding: utf-8 -*-
 # Copyright: 2003-2004 by Juergen Hermann <jh@web.de>
 # Copyright: 2009 by ReimarBauer
-# Copyright: 2013 by ThomasWaldmann
+# Copyright: 2011-2013 by ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
     def testUnicodePassword(self):
         """ user: login with non-ascii password """
         # Create test user
-        name = u'__שם משתמש לא קיים__' # Hebrew
+        name = u'__שם משתמש לא קיים__'  # Hebrew
         password = name
         self.createUser(name, password)
 
         assert theUser.valid
 
         # invalidate the stored password (hash)
-        theUser.set_password("") # emptry str or None means "invalidate"
+        theUser.set_password("")  # emptry str or None means "invalidate"
         theUser.save()
 
         # Try to "login" with previous password
         # Login - this should replace the old password in the user file
         theUser = user.User(name=name, password=password)
         theUser.subscribe(pagename)
-        assert theUser.is_subscribed_to([pagename]) # list(!) of pages to check
+        assert theUser.is_subscribed_to([pagename])  # list(!) of pages to check
 
     def testSubscriptionSubPage(self):
         """ user: tests is_subscribed_to on a subpage """
         # Login - this should replace the old password in the user file
         theUser = user.User(name=name, password=password)
         theUser.subscribe(pagename)
-        assert not theUser.is_subscribed_to([testPagename]) # list(!) of pages to check
+        assert not theUser.is_subscribed_to([testPagename])  # list(!) of pages to check
 
     # Bookmarks -------------------------------------------------------
 
     def testValid(self):
         """ user: isValidName: accept names in any language, with spaces """
         cases = (
-            u'Jürgen Hermann', # German
-            u'ניר סופר', # Hebrew
-            u'CamelCase', # Good old camel case
-            u'가각간갇갈 갉갊감 갬갯걀갼' # Hangul (gibberish)
+            u'Jürgen Hermann',  # German
+            u'ניר סופר',  # Hebrew
+            u'CamelCase',  # Good old camel case
+            u'가각간갇갈 갉갊감 갬갯걀갼'  # Hangul (gibberish)
             )
         for test in cases:
             assert user.isValidName(test)

MoinMoin/_tests/test_wikiutil.py

 # Copyright: 2003-2004 by Juergen Hermann <jh@web.de>
-# Copyright: 2007 by MoinMoin:ThomasWaldmann
+# Copyright: 2007-2013 by MoinMoin:ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
 
 class TestCleanInput(object):
     def testCleanInput(self):
-        tests = [(u"", u""), # empty
-                 (u"aaa\r\n\tbbb", u"aaa   bbb"), # ws chars -> blanks
-                 (u"aaa\x00\x01bbb", u"aaabbb"), # strip weird chars
-                 (u"a"*500, u""), # too long
+        tests = [(u"", u""),  # empty
+                 (u"aaa\r\n\tbbb", u"aaa   bbb"),  # ws chars -> blanks
+                 (u"aaa\x00\x01bbb", u"aaabbb"),  # strip weird chars
+                 (u"a" * 500, u""),  # too long
                 ]
         for instr, outstr in tests:
             assert wikiutil.clean_input(instr) == outstr
         (('MainPage', '/SubPage1'), 'MainPage/SubPage1'),
         (('MainPage', '/SubPage1/SubPage2'), 'MainPage/SubPage1/SubPage2'),
         (('MainPage/SubPage1', '/SubPage2/SubPage3'), 'MainPage/SubPage1/SubPage2/SubPage3'),
-        (('', '/OtherMainPage'), 'OtherMainPage'), # strange
+        (('', '/OtherMainPage'), 'OtherMainPage'),  # strange
         # PARENT_PREFIX
         (('MainPage/SubPage', '../SisterPage'), 'MainPage/SisterPage'),
         (('MainPage/SubPage1/SubPage2', '../SisterPage'), 'MainPage/SubPage1/SisterPage'),
         (('MainPage/SubPage1/SubPage2', '../../SisterPage'), 'MainPage/SisterPage'),
-        (('MainPage', '../SisterPage'), 'SisterPage'), # strange
+        (('MainPage', '../SisterPage'), 'SisterPage'),  # strange
     ]
+
     def test_abs_pagename(self):
         for (current_page, relative_page), absolute_page in self.tests:
             yield self._check_abs_pagename, current_page, relative_page, absolute_page
             result = wikiutil.normalize_pagename(test, app.cfg)
             assert result == expected
 
+
 class TestGroupItems(object):
 
     def testNormalizeGroupName(self):
     expected = u'some/parent'
     assert result == expected
 
+
 def testdrawing2fname():
     # with extension not in DRAWING_EXTENSIONS
     result = wikiutil.drawing2fname('Moin_drawing.txt')
     expected = 'Moindir.Moin_drawing.jpg'
     assert result == expected
 
+
 def testgetUnicodeIndexGroup():
     result = wikiutil.getUnicodeIndexGroup(['moin-2', 'MoinMoin'])
     expected = 'MOIN-2'
     with pytest.raises(IndexError):
         result = wikiutil.getUnicodeIndexGroup('')
 
+
 def testis_URL():
     sample_schemes = ['http', 'https', 'ftp', 'ssh']
     for scheme in sample_schemes:
     result = wikiutil.is_URL('invalid_scheme:MoinMoin')
     assert not result
 
+
 def testcontainsConflictMarker():
     # text with conflict marker
     result = wikiutil.containsConflictMarker("/!\\ '''Edit conflict - Conflict marker is present")
     result = wikiutil.containsConflictMarker('No conflict marker')
     assert not result
 
+
 def testsplit_anchor():
     """
     TODO: add the test for for split_anchor when we have better
     expected = ['#MoinMoin', '']
     assert result == expected
 
+
 def testfile_headers():
     test_headers = [
                 #test_file, content_type
     expected = [('Content-Type', 'text/plain')]
     assert result == expected
 
+
 coverage_modules = ['MoinMoin.wikiutil']

MoinMoin/_tests/wikiconfig.py

 # Copyright: 2000-2004 by Juergen Hermann <jh@web.de>
+# Copyright: 2011-2013 by MoinMoin:ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
 
 import os
 from os.path import abspath, dirname, join
+
 from MoinMoin.config.default import DefaultConfig
 
 
 class Config(DefaultConfig):
+    """
+    default configuration for the unit tests
+    """
     _here = abspath(dirname(__file__))
     _root = abspath(join(_here, '..', '..'))
     data_dir = join(_here, 'wiki', 'data')  # needed for plugins package TODO

MoinMoin/apps/admin/_tests/test_admin.py

 
 from flask import url_for
 
+
 class TestAdmin(object):
     def _test_view_get(self, url, status='200 OK', data=('<html>', '</html>')):
         with self.app.test_client() as c:

MoinMoin/apps/feed/_tests/test_feed.py

 from MoinMoin.constants.keys import COMMENT
 from MoinMoin._tests import update_item, wikiconfig
 
+
 class TestFeeds(object):
     class Config(wikiconfig.Config):
         """

MoinMoin/apps/frontend/_tests/test_frontend.py

 
     def test_favicon(self):
         rv = self._test_view('frontend.favicon', content_types=['image/x-icon', 'image/vnd.microsoft.icon', ], data=[])
-        assert rv.data.startswith('\x00\x00') # "reserved word, should always be 0"
+        assert rv.data.startswith('\x00\x00')  # "reserved word, should always be 0"
 
     def test_global_tags(self):
         self._test_view('frontend.global_tags')
         flaskg.user = user.User(name=u'moin', password=u'Xiwejr622')
         form = self.fillPasswordChangeForm(u'Xiwejr622', u'Woodoo645', u'Woodoo645')
         valid = form.validate()
-        assert valid # form data is valid
+        assert valid  # form data is valid
 
     def test_user_unicode_password_change(self):
         name = u'moin'
-        password = u'__שם משתמש לא קיים__' # Hebrew
+        password = u'__שם משתמש לא קיים__'  # Hebrew
 
         self.createUser(name, password)
         flaskg.user = user.User(name=name, password=password)
         form = self.fillPasswordChangeForm(password, u'Woodoo645', u'Woodoo645')
         valid = form.validate()
-        assert valid # form data is valid
+        assert valid  # form data is valid
 
     def test_user_password_change_to_unicode_pw(self):
         name = u'moin'
         password = u'Xiwejr622'
-        new_password = u'__שם משתמש לא קיים__' # Hebrew
+        new_password = u'__שם משתמש לא קיים__'  # Hebrew
 
         self.createUser(name, password)
         flaskg.user = user.User(name=name, password=password)
         form = self.fillPasswordChangeForm(password, new_password, new_password)
         valid = form.validate()
-        assert valid # form data is valid
+        assert valid  # form data is valid
 
     def test_fail_user_password_change_pw_mismatch(self):
         self.createUser(u'moin', u'Xiwejr622')

MoinMoin/apps/misc/_tests/test_misc.py

 
 from MoinMoin._tests import wikiconfig
 
+
 class TestMisc(object):
     class Config(wikiconfig.Config):
         """

MoinMoin/apps/serve/_tests/test_serve.py

 
 from flask import url_for
 
+
 class TestServe(object):
     def test_index(self):
         with self.app.test_client() as c:

MoinMoin/auth/_tests/test_auth.py

 from MoinMoin.auth import GivenAuth, handle_login, get_multistage_continuation_url
 from MoinMoin.user import create_user
 
+
 class TestConfiguredGivenAuth(object):
     """ Test: configured GivenAuth """
     class Config(wikiconfig.Config):
         assert test_user.valid
         assert test_user.name == [u'Test_User', ]
 
+
 def test_handle_login():
     # no messages in the beginning
     assert not flaskg._login_messages
     assert test_user2.name == [u'Test_User', ]
     assert test_user2.valid
 
+
 def test_get_multistage_continuation_url():
-    test_url = get_multistage_continuation_url('test_auth_name', extra_fields={'password': 'test_pass', 'test_key': 'test_value'})
+    test_url = get_multistage_continuation_url('test_auth_name',
+                                               extra_fields={'password': 'test_pass', 'test_key': 'test_value'})
     assert 'test_key=test_value' in test_url
     assert 'password=test_pass' in test_url
     assert 'stage=test_auth_name' in test_url

MoinMoin/auth/_tests/test_ldap_login.py

 
 import ldap
 
+
 class TestLDAPServer(LDAPTstBase):
     basedn = BASEDN
     rootdn = ROOTDN
         server_uri = self.ldap_env.slapd.url
         base_dn = self.ldap_env.basedn
         lo = ldap.initialize(server_uri)
-        ldap.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3) # ldap v2 is outdated
+        ldap.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)  # ldap v2 is outdated
         lo.simple_bind_s('', '')
         lusers = lo.search_st(base_dn, ldap.SCOPE_SUBTREE, '(uid=*)')
         uids = [ldap_dict['uid'][0] for dn, ldap_dict in lusers]
         assert 'usera' in uids
         assert 'userb' in uids
 
+
 class TestMoinLDAPLogin(LDAPTstBase):
     basedn = BASEDN
     rootdn = ROOTDN
         u2 = handle_login(None, username='usera', password='wrong')
         assert u2 is None
 
+
 class TestTwoLdapServers(object):
     basedn = BASEDN
     rootdn = ROOTDN
             server_uri = ldap_env.slapd.url
             base_dn = ldap_env.basedn
             lo = ldap.initialize(server_uri)
-            ldap.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3) # ldap v2 is outdated
+            ldap.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)  # ldap v2 is outdated
             lo.simple_bind_s('', '')
             lusers = lo.search_st(base_dn, ldap.SCOPE_SUBTREE, '(uid=*)')
             uids = [ldap_dict['uid'][0] for dn, ldap_dict in lusers]
             try:
                 ldap_env.stop_slapd()
             except:
-                pass # one will fail, because it is already stopped
+                pass  # one will fail, because it is already stopped
             ldap_env.destroy_env()
 
     def testMoinLDAPFailOver(self):

MoinMoin/config/_tests/test_defaultconfig.py

 
 from flask import current_app as app
 
+
 class TestPasswordChecker(object):
     username = u"SomeUser"
     tests_builtin = [
-        (u'', False), # empty
-        (u'1966', False), # too short
-        (u'asdfghjk', False), # keyboard sequence
-        (u'QwertZuiop', False), # german keyboard sequence, with uppercase
-        (u'mnbvcx', False), # reverse keyboard sequence
-        (u'12345678', False), # keyboard sequence, too easy
-        (u'aaaaaaaa', False), # not enough different chars
-        (u'BBBaaaddd', False), # not enough different chars
-        (username, False), # username == password
-        (username[1:-1], False), # password in username
-        (u"XXX{0}XXX".format(username), False), # username in password
-        (u'Moin-2007', True), # this should be OK
+        (u'', False),  # empty
+        (u'1966', False),  # too short
+        (u'asdfghjk', False),  # keyboard sequence
+        (u'QwertZuiop', False),  # german keyboard sequence, with uppercase
+        (u'mnbvcx', False),  # reverse keyboard sequence
+        (u'12345678', False),  # keyboard sequence, too easy
+        (u'aaaaaaaa', False),  # not enough different chars
+        (u'BBBaaaddd', False),  # not enough different chars
+        (username, False),  # username == password
+        (username[1:-1], False),  # password in username
+        (u"XXX{0}XXX".format(username), False),  # username in password
+        (u'Moin-2007', True),  # this should be OK
     ]
+
     def testBuiltinPasswordChecker(self):
         pw_checker = app.cfg.password_checker
         if not pw_checker:
                 print "{0!r}: {1}".format(pw, pw_error)
                 assert result == (pw_error is None)
 
+
 coverage_modules = ['MoinMoin.config.default']

MoinMoin/converter/_tests/test__args.py

 
 from MoinMoin.converter._args import *
 
+
 def test_Arguments___init__():
     positional = []
     keyword = {}
     assert keyword == a.keyword
     assert keyword is not a.keyword
 
+
 def test_Arguments___contains__():
     positional = ['positional', 'both']
     keyword = {'keyword': None, 'both': None}
     assert 'both' in a
     assert 'none' not in a
 
+
 def test_Arguments___getitem__():
     positional = ['positional', 'both']
     keyword = {'keyword': None, 'both': None}
     pytest.raises(IndexError, a.__getitem__, 2)
     pytest.raises(KeyError, a.__getitem__, 'none')
 
+
 def test_Arguments___len__():
     positional = ['positional', 'both']
     keyword = {'keyword': None, 'both': None}
 
     assert len(a) == 4
 
+
 def test_Arguments_items():
     positional = ['positional', 'both']
     keyword = {'keyword': True, 'both': False}
     assert ('keyword', True) in l
     assert ('both', False) in l
 
+
 def test_Arguments_keys():
     positional = ['positional', 'both']
     keyword = {'keyword': True, 'both': False}
     assert 'keyword' in l
     assert 'both' in l
 
+
 def test_Arguments_values():
     positional = ['positional', 'both']
     keyword = {'keyword': True, 'both': False}

MoinMoin/converter/_tests/test__args_wiki.py

 
 from MoinMoin.converter._args_wiki import *
 
+
 def test():
     yield (do,
         ur'both positional both=foo keyword=bar',
         [u'a b\tc\nd'],
         {u'k': u'a b\tc\nd'})
 
+
 def test_parse():
     a = parse(ur''''a b\tc\nd',k="a b\tc\nd"''')
     assert a.positional == [u'a b\tc\nd']
     assert a.keyword == {u'k': u'a b\tc\nd'}
 
+
 def do(wiki, positional, keyword):
     a = parse(wiki)
     assert a.positional == positional

MoinMoin/converter/_tests/test_docbook_in.py

 
 from MoinMoin.converter.docbook_in import *
 
+
 class Base(object):
     input_namespaces = ns_all = u'xmlns="{0}" xmlns:xlink="{1}"'.format(docbook.namespace, xlink.namespace)
     output_namespaces = {
         tree = etree.parse(StringIO.StringIO(string_to_parse))
         assert (tree.xpath(xpath_query, namespaces=self.namespaces_xpath))
 
+
 class TestConverter(Base):
     def setup_class(self):
         self.conv = Converter()

MoinMoin/converter/_tests/test_docbook_out.py

 
 from MoinMoin.converter.docbook_out import *
 
+
 class Base(object):
     input_namespaces = ns_all = 'xmlns="{0}" xmlns:page="{1}" xmlns:html="{2}" xmlns:xlink="{3}" xmlns:xml="{4}"'.format(moin_page.namespace, moin_page.namespace, html.namespace, xlink.namespace, xml.namespace)
     output_namespaces = {
         tree = etree.parse(StringIO.StringIO(string_to_parse))
         assert (tree.xpath(xpath, namespaces=self.namespaces_xpath))
 
+
 class TestConverter(Base):
     def setup_class(self):
         self.conv = Converter()

MoinMoin/converter/_tests/test_html_in.py

 logging = log.getLogger(__name__)
 from MoinMoin.converter.html_in import *
 
+
 class Base(object):
     namespaces = {
         moin_page.namespace: '',
         tree = etree.parse(StringIO.StringIO(string_to_parse))
         assert (tree.xpath(path, namespaces=self.namespaces_xpath))
 
+
 class TestConverter(Base):
     def setup_class(self):
         self.conv = Converter()

MoinMoin/converter/_tests/test_html_in_out.py

 from MoinMoin.converter.html_out import Converter as HTML_OUT
 from MoinMoin.util.tree import html, moin_page, xlink
 
+
 class Base(object):
 
     namespaces = {
         tree = etree.parse(StringIO.StringIO(string_to_parse))
         assert (tree.xpath(path))
 
+
 class TestConverter(Base):
     def setup_class(self):
         self.conv_html_dom = HTML_IN()

MoinMoin/converter/_tests/test_html_out.py

 
 from MoinMoin.converter.html_out import *
 
+
 class Base(object):
     input_namespaces = ns_all = 'xmlns="{0}" xmlns:page="{1}" xmlns:html="{2}" xmlns:xlink="{3}" xmlns:xml="{4}"'.format(moin_page.namespace, moin_page.namespace, html.namespace, xlink.namespace, xml.namespace)
     output_namespaces = {
         tree = etree.parse(StringIO.StringIO(string_to_parse))
         assert (tree.xpath(xpath))
 
+
 class TestConverter(Base):
     def setup_class(self):
         self.conv = Converter()
         for i in data:
             yield (self.do, ) + i
 
+
 class TestConverterPage(Base):
     def setup_class(self):
         self.conv = ConverterPage()

MoinMoin/converter/_tests/test_include.py

 from MoinMoin.constants.keys import CONTENTTYPE
 from MoinMoin._tests import wikiconfig, update_item
 
+
 class TestInclude(object):
     class Config(wikiconfig.Config):
         """
         update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u"")
         rendered = Item.create(u'page1').content._render_data()
         assert '<p>text <span class="moin-transclusion" data-href="/page2"></span> text</p>' in rendered
+
     def test_InlineIncludeCreole(self):
         # transclude single paragraph as inline using creole parser
         update_item(u'creole', {CONTENTTYPE: u'text/x.moin.creole;charset=utf-8'}, u'creole item')
         update_item(u'page1', {CONTENTTYPE: u'text/x.moin.creole;charset=utf-8'}, u'before {{creole}} after')
         rendered = Item.create(u'page1').content._render_data()
         assert '<p>before <span class="moin-transclusion" data-href="/creole">creole item</span> after</p>' in rendered
+
     def test_InlineIncludeWithinMarkup(self):
         # transclude single line item within italic and bold markup
         update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u"Normal ''italic '''bold {{page2}} bold''' italic'' normal")

MoinMoin/converter/_tests/test_link.py

 from MoinMoin.converter.link import *
 from MoinMoin.util.iri import Iri
 
+
 class TestConverterExternOutput(object):
     def setup_class(self):
         self.conv = ConverterExternOutput()

MoinMoin/converter/_tests/test_moinwiki19_in.py

                 '<page><body><p><a xlink:href="mailto:foo@bar.baz">mailto:foo@bar.baz</a></p></body></page>'),
             (u'foo@bar.baz',
                 '<page><body><p><a xlink:href="mailto:foo@bar.baz">foo@bar.baz</a></p></body></page>'),
-            (u'foo@bar', # 1.9 requires domain
+            (u'foo@bar',  # 1.9 requires domain
                 '<page><body><p>foo@bar</p></body></page>'),
         ]
         for i in data:

MoinMoin/converter/_tests/test_moinwiki_in.py

 
     def test_heading(self):
         data = [
-            (u'=Not_a_Heading=', # this is for better moin 1.x compatibility
+            (u'=Not_a_Heading=',  # this is for better moin 1.x compatibility
                 '<page><body><p>=Not_a_Heading=</p></body></page>'),
             (u'= Heading 1 =',
                 '<page><body><h outline-level="1">Heading 1</h></body></page>'),
         ]
         for i in data:
             yield (self.do, ) + i
+
     def test_interwiki(self):
         data = [
             (u'[[MoinMoin:RecentChanges]]',
                 '<page><body><p><a xlink:href="mailto:foo@bar.baz">mailto:foo@bar.baz</a></p></body></page>'),
             (u'[[mailto:foo@bar.baz|write me]]',
                 '<page><body><p><a xlink:href="mailto:foo@bar.baz">write me</a></p></body></page>'),
-            (u'[[mailto:foo.bar_baz@bar.baz]]', # . and _ are special characters commonly allowed by email systems
+            (u'[[mailto:foo.bar_baz@bar.baz]]',  # . and _ are special characters commonly allowed by email systems
                 '<page><body><p><a xlink:href="mailto:foo.bar_baz@bar.baz">mailto:foo.bar_baz@bar.baz</a></p></body></page>'),
         ]
         for i in data:

MoinMoin/converter/_tests/test_moinwiki_in_out.py

             yield (self.do, ) + i
 
     def test_page(self):
-        pytest.skip("please help fixing moin wiki round trip tests") # XXX TODO
+        pytest.skip("please help fixing moin wiki round trip tests")  # XXX TODO
         data = [
             (u"""
 This page aims to introduce the most important elements of MoinMoin``'s syntax at a glance, showing first the markup verbatim and then how it is rendered by the wiki engine. Additionally, you'll find links to the relative help pages. Please note that some of the features depend on your configuration.

MoinMoin/converter/_tests/test_rst_in.py

         out = self.conv(input, 'text/x-rst;charset=utf-8', **args)
         assert self.serialize(out) == output
 
+
 coverage_modules = ['MoinMoin.converter.rst_in']

MoinMoin/converter/_tests/test_rst_out.py

         for i in data:
             yield (self.do, ) + i
 
+
 coverage_modules = ['MoinMoin.converter.rst_out']

MoinMoin/datastruct/backends/_tests/test_config_dicts.py

         for result in test_keyiterator:
             assert result in expected
 
+
 coverage_modules = ['MoinMoin.datastruct.backends.config_dicts']

MoinMoin/datastruct/backends/_tests/test_wiki_dicts.py

 from MoinMoin.datastruct.backends import wiki_dicts
 from MoinMoin.constants.keys import SOMEDICT
 from MoinMoin._tests import become_trusted, update_item
+
 DATA = "This is a dict item."
 
 
         expected = {u'Two': u'2', u'One': u'1'}
         assert result == expected
 
+
 coverage_modules = ['MoinMoin.datastruct.backends.wiki_dicts']

MoinMoin/datastruct/backends/_tests/test_wiki_groups.py

         assert not has_rights_before, 'AnotherUser has no read rights because in the beginning he is not a member of a group item NewGroup'
         assert has_rights_after, 'AnotherUser must have read rights because after appenditem he is member of NewGroup'
 
+
 coverage_modules = ['MoinMoin.datastruct.backends.wiki_groups']

MoinMoin/i18n/_tests/test_i18n.py

 
 from MoinMoin.i18n import _, L_, N_
 
+
 def test_user_attributes():
     test_locale = get_locale()
     assert test_locale == 'en'
     test_timezone = get_timezone()
     assert test_timezone == 'UTC'
 
+
 def test_text():
     # test for gettext
     result = _('test_text')

MoinMoin/items/_tests/test_Content.py

         result2 = item1.content.get_templates(contenttype2)
         assert result2 == [item_name3]
 
+
 class TestTarItems(object):
     """
     tests for the container items
         item = Item.create(item_name, contenttype=u'application/x-tar')
         assert item.content.get_member('example1.txt').read() == filecontent
 
+
 class TestZipMixin(object):
     """ Test for zip-like items """
 
         with pytest.raises(NotImplementedError):
             item.content.put_member('example1.txt', filecontent, content_length, expected_members=members)
 
+
 class TestTransformableBitmapImage(object):
 
     def test__transform(self):
         except ImportError:
             pass
 
+
 class TestText(object):
 
     def test_data_conversion(self):
         assert u'<pre class="highlight">test_data\n' in result
         assert item2.content.data == ''
 
+
 coverage_modules = ['MoinMoin.items.content']

MoinMoin/items/_tests/test_Item.py

     return [(IndexEntry(relname, Item.create('/'.join((basename, relname))).meta))
             for relname in relnames]
 
+
 def build_mixed_index(basename, spec):
     """
     Build a list of MixedIndexEntry by hand, useful as a test helper.
         assert item.meta['another_test_key'] == another_meta['another_test_key']
         assert item.content.data == another_data
 
+
 coverage_modules = ['MoinMoin.items']

MoinMoin/macro/_tests/test_Anchor.py

 """
 
 import pytest
+
 from MoinMoin.macro.Anchor import *
 
+
 def test_Macro():
     macro_obj = Macro()
     with pytest.raises(ValueError):

MoinMoin/macro/_tests/test_Date.py

 import time
 from datetime import datetime
 
+import pytest
 from flask.ext.babel import format_date, format_datetime
 
 from MoinMoin.macro.Date import MacroDateTimeBase, Macro
-import pytest
+
 
 class TestMacroDateTimeBase(object):
     def test_parse_time(self):
             # things after next 10,000 years can't be predicted
             MacroDateTimeBase_obj.parse_time('12011-08-07T11:11:11')
 
+
 class TestMacro(object):
     def test_macro(self):
         macro_obj = Macro()

MoinMoin/macro/_tests/test_DateTime.py

 import time
 from datetime import datetime
 
+import pytest
+
 from MoinMoin.macro.DateTime import *
-import pytest
+
 
 def test_Macro():
     """Test: DateTime.Macro """

MoinMoin/macro/_tests/test_GetText.py

 from MoinMoin.converter._args import Arguments
 from MoinMoin.macro.GetText import *
 
+
 def test_Macro():
     """ test for Macro.macro """
     macro_obj = Macro()

MoinMoin/macro/_tests/test_GetVal.py

 Test for macro.GetVal
 """
 
+import pytest
 from flask import g as flaskg
 
 from MoinMoin.macro.GetVal import *
 from MoinMoin._tests import become_trusted, update_item
 from MoinMoin.conftest import init_test_app, deinit_test_app
 from MoinMoin._tests import wikiconfig
-import pytest
+
 DATA = "This is a dict item."
 
+
 class TestMacro(object):
     """ Test: GetVal.Macro """
 

MoinMoin/macro/_tests/test_Verbatim.py

 
 from MoinMoin.macro.Verbatim import *
 
+
 def test_Macro():
     macro_obj = Macro()
     result = macro_obj.macro(u'test_text')

MoinMoin/macro/_tests/test__base.py

 import pytest
 from MoinMoin.macro._base import *
 
+
 class TestMacroBase(object):
     """ Test for Macro base and related classes """
 

MoinMoin/mail/_tests/test_sendmail.py

 
 from email.Charset import Charset, QP
 from email.Header import Header
+
 from MoinMoin.mail import sendmail
 from MoinMoin.constants.contenttypes import CHARSET
 
         for coded, expected in self._tests:
             assert sendmail.decodeSpamSafeEmail(coded) == expected
 
+
 class TestencodeSpamSafeEmail(object):
     """mail.sendmail: testing spam safe mail"""
 
             expected = expected.replace(' AT ', ' AT SYCTE ')
             assert sendmail.encodeSpamSafeEmail(coded, 'SYCTE') == expected
 
+
 class TestEncodeAddress(object):
     """ Address encoding tests
 
         expected = str(address)
         assert sendmail.encodeAddress(address, self.charset) == expected
 
+
 coverage_modules = ['MoinMoin.mail.sendmail']

MoinMoin/security/_tests/test_security.py

 class TestGroupACL(object):
 
     from MoinMoin._tests import wikiconfig
+
     class Config(wikiconfig.Config):
         def groups(cfg):
             groups = {
                 # the group NAME, but not in the group members. This makes
                 # sure that a bug that erroneously checked "in groupname" (instead
                 # of "in groupmembers") does not reappear.
-                u'AllGroup': frozenset([]), # note: intended misnomer
+                u'AllGroup': frozenset([]),  # note: intended misnomer
             }
             return ConfigGroups(groups)
 
     ]
 
     from MoinMoin._tests import wikiconfig
+
     class Config(wikiconfig.Config):
         content_acl = dict(hierarchic=False, before=u"WikiAdmin:admin,read,write,create,destroy", default=u"All:read,write", after=u"All:read")
         acl_functions = u"SuperUser:superuser NoTextchaUser:notextcha"
         tests = [
             # itemname, username, expected_rights
             (self.mainitem_name, u'WikiAdmin', ['read', 'write', 'admin', 'create', 'destroy']),
-            (self.mainitem_name, u'AnyUser', ['read']), # by after acl
-            (self.mainitem_name, u'JaneDoe', ['read', 'write']), # by item acl
-            (self.mainitem_name, u'JoeDoe', []), # by item acl
+            (self.mainitem_name, u'AnyUser', ['read']),  # by after acl
+            (self.mainitem_name, u'JaneDoe', ['read', 'write']),  # by item acl
+            (self.mainitem_name, u'JoeDoe', []),  # by item acl
             (self.subitem1_name, u'WikiAdmin', ['read', 'write', 'admin', 'create', 'destroy']),
-            (self.subitem1_name, u'AnyUser', ['read', 'write']), # by default acl
-            (self.subitem1_name, u'JoeDoe', ['read', 'write']), # by default acl
-            (self.subitem1_name, u'JaneDoe', ['read', 'write']), # by default acl
+            (self.subitem1_name, u'AnyUser', ['read', 'write']),  # by default acl
+            (self.subitem1_name, u'JoeDoe', ['read', 'write']),  # by default acl
+            (self.subitem1_name, u'JaneDoe', ['read', 'write']),  # by default acl
             (self.subitem2_name, u'WikiAdmin', ['read', 'write', 'admin', 'create', 'destroy']),
-            (self.subitem2_name, u'AnyUser', ['read']), # by after acl
-            (self.subitem2_name, u'JoeDoe', ['read']), # by after acl
-            (self.subitem2_name, u'JaneDoe', ['read']), # by after acl
+            (self.subitem2_name, u'AnyUser', ['read']),  # by after acl
+            (self.subitem2_name, u'JoeDoe', ['read']),  # by after acl
+            (self.subitem2_name, u'JaneDoe', ['read']),  # by after acl
         ]
 
         for itemname, username, may in tests:
         assert not u.may.superuser()
         assert not u.may.notextcha()
 
+
 class TestItemHierachicalAcls(object):
     """ security: real-life access control list on items testing
     """
     ]
 
     from MoinMoin._tests import wikiconfig
+
     class Config(wikiconfig.Config):
         content_acl = dict(hierarchic=True, before=u"WikiAdmin:admin,read,write,create,destroy", default=u"All:read,write", after=u"All:read")
 
         tests = [
             # itemname, username, expected_rights
             (self.mainitem_name, u'WikiAdmin', ['read', 'write', 'admin', 'create', 'destroy']),
-            (self.mainitem_name, u'AnyUser', ['read']), # by after acl
-            (self.mainitem_name, u'JaneDoe', ['read', 'write']), # by item acl
-            (self.mainitem_name, u'JoeDoe', []), # by item acl
+            (self.mainitem_name, u'AnyUser', ['read']),  # by after acl
+            (self.mainitem_name, u'JaneDoe', ['read', 'write']),  # by item acl
+            (self.mainitem_name, u'JoeDoe', []),  # by item acl
             (self.subitem1_name, u'WikiAdmin', ['read', 'write', 'admin', 'create', 'destroy']),
-            (self.subitem1_name, u'AnyUser', ['read']), # by after acl
-            (self.subitem1_name, u'JoeDoe', []), # by inherited acl from main item
-            (self.subitem1_name, u'JaneDoe', ['read', 'write']), # by inherited acl from main item
+            (self.subitem1_name, u'AnyUser', ['read']),  # by after acl
+            (self.subitem1_name, u'JoeDoe', []),  # by inherited acl from main item
+            (self.subitem1_name, u'JaneDoe', ['read', 'write']),  # by inherited acl from main item
             (self.subitem2_name, u'WikiAdmin', ['read', 'write', 'admin', 'create', 'destroy']),
-            (self.subitem2_name, u'AnyUser', ['read']), # by after acl
-            (self.subitem2_name, u'JoeDoe', ['read']), # by after acl
-            (self.subitem2_name, u'JaneDoe', ['read']), # by after acl
-            (self.subitem_4boss, u'AnyUser', ['read']), # by after acl
-            (self.subitem_4boss, u'JoeDoe', ['read', 'write']), # by item acl
+            (self.subitem2_name, u'AnyUser', ['read']),  # by after acl
+            (self.subitem2_name, u'JoeDoe', ['read']),  # by after acl
+            (self.subitem2_name, u'JaneDoe', ['read']),  # by after acl
+            (self.subitem_4boss, u'AnyUser', ['read']),  # by after acl
+            (self.subitem_4boss, u'JoeDoe', ['read', 'write']),  # by item acl
         ]
 
         for itemname, username, may in tests:

MoinMoin/security/_tests/test_textcha.py

         assert textcha_obj.form['textcha_question'].optional
         assert textcha_obj.form['textcha'].optional
 
+
 class TestTextChaValid(object):
     """ Test: class TextChaValid """
     def setup_method(self, method):

MoinMoin/storage/backends/_tests/__init__.py

 
 from MoinMoin.constants.keys import SIZE, HASH_ALGORITHM
 
+
 class BackendTestBase(object):
     def setup_method(self, method):
         """
             metaid = self.be.store(meta, StringIO(data))
 
     def test_iter(self):
-        mds = [# (metadata items, data str)
+        mds = [  # (metadata items, data str)
                 (dict(name='one'), 'ONE'),
                 (dict(name='two'), 'TWO'),
                 (dict(name='three'), 'THREE'),

MoinMoin/storage/backends/_tests/test_fileserver.py

     def test_files(self):
         # note: as we can only store the data into the file system, meta can
         # only have items that are generated by the fileserver backend:
-        items = [# name,  meta,   data
+        items = [  # name,  meta,   data
                  (u'foo.png', dict(size=11, contenttype=u'image/png'), 'png content'),
                  (u'bar.txt', dict(size=12, contenttype=u'text/plain'), 'text content'),
                 ]
     def test_dir(self):
         # note: as we can only store the data into the file system, meta can
         # only have items that are generated by the fileserver backend:
-        items = [# name,  meta,   data
+        items = [  # name,  meta,   data
                  (u'dir/foo.png', dict(size=11, contenttype=u'image/png'), 'png content'),
                  (u'dir/bar.txt', dict(size=12, contenttype=u'text/plain'), 'text content'),
                 ]

MoinMoin/storage/backends/_tests/test_stores.py

 from MoinMoin.storage.stores.memory import BytesStore as MemoryBytesStore
 from MoinMoin.storage.stores.memory import FileStore as MemoryFileStore
 
+
 class TestMemoryBackend(MutableBackendTestBase):
     def setup_method(self, method):
         meta_store = MemoryBytesStore()
 from MoinMoin.storage.stores.fs import BytesStore as FSBytesStore
 from MoinMoin.storage.stores.fs import FileStore as FSFileStore
 
+
 class TestFSBackend(MutableBackendTestBase):
     def setup_method(self, method):
         meta_path = tempfile.mkdtemp()

MoinMoin/storage/middleware/_tests/test_indexing.py

 
 
 class TestIndexingMiddleware(object):
-    reinit_storage = True # cleanup after each test method
+    reinit_storage = True  # cleanup after each test method
 
     def setup_method(self, method):
         self.imw = flaskg.unprotected_storage
 
     def test_nonexisting_item(self):
         item = self.imw[u'foo']
-        assert not item # does not exist
+        assert not item  # does not exist
 
     def test_store_revision(self):
         item_name = u'foo'
         revid = rev.revid
         # check if we have the revision now:
         item = self.imw[item_name]
-        assert item # does exist
+        assert item  # does exist
         rev = item.get_revision(revid)
         assert rev.name == item_name
         assert rev.data.read() == data
         assert rev.meta[COMMENT] == u'no spam'
         assert rev.data.read() == newdata
         revids = [rev.revid for rev in item.iter_revs()]
-        assert len(revids) == 1 # we still have the revision, cleared
-        assert revid in revids # it is still same revid
+        assert len(revids) == 1  # we still have the revision, cleared
+        assert revid in revids  # it is still same revid
 
     def test_destroy_revision(self):
         item_name = u'foo'
         item.destroy_all_revisions()
         # check if the item was destroyed:
         item = self.imw[item_name]
-        assert not item # does not exist
+        assert not item  # does not exist
 
     def test_all_revisions(self):
         item_name = u'foo'
         item = self.imw[item_name]
         assert item.parentnames == [u'p1', u'p2', u'p3/p4', ]  # one p2 duplicate removed
 
+
 class TestProtectedIndexingMiddleware(object):
-    reinit_storage = True # cleanup after each test method
+    reinit_storage = True  # cleanup after each test method
 
     class Config(wikiconfig.Config):
         auth = [GivenAuth(user_name=u'joe', autocreate=True), ]
                                 StringIO('public content'), return_rev=True)
         revid_public = r.revid
         revids = [rev.revid for rev in self.imw.documents()
-                  if rev.name != u'joe'] # the user profile is a revision in the backend
+                  if rev.name != u'joe']  # the user profile is a revision in the backend
         assert revids == [revid_public]
 
     def test_getitem(self):

MoinMoin/storage/middleware/_tests/test_protecting.py

     ('', dict(before=u'', default=u'All:read,write,create', after=u'', hierarchic=False)),
 ]
 
+
 class FakeUser(object):
     """
     fake user object, just to give user.name
     """
     def __init__(self, name):
         self.name = [name, ]
+
     @property
     def name0(self):
         return self.name[0]

MoinMoin/storage/middleware/_tests/test_routing.py

 
     return router
 
+
 def test_store_get_del(router):
     default_name = u'foo'
     default_backend_name, default_revid = router.store(dict(name=[default_name, ]), StringIO(''))
     with pytest.raises(TypeError):
         router.store(dict(name=[u'ro:testing', ]), StringIO(''))
 
+
 def test_del_readonly_fails(router):
-    ro_be_name, ro_id = next(iter(router)) # we have only readonly items
+    ro_be_name, ro_id = next(iter(router))  # we have only readonly items
     print ro_be_name, ro_id
     with pytest.raises(TypeError):
         router.remove(ro_be_name, ro_id)

MoinMoin/storage/middleware/_tests/test_serialization.py

 def pytest_generate_tests(metafunc):
     metafunc.addcall(id='Simple->Simple', param=('Simple', 'Simple'))
 
+
 def pytest_funcarg__source(request):
     # scenario
     return make_middleware(request)
 
+
 def pytest_funcarg__target(request):
     # scenario
     return make_middleware(request)
 
+
 def make_middleware(request):
     tmpdir = request.getfuncargvalue('tmpdir')
     # scenario
     request.addfinalizer(backend.destroy)
     request.addfinalizer(backend.close)
 
-    mw = IndexingMiddleware(index_storage=(WHOOSH_FILESTORAGE, (str(tmpdir/'foo'), ), {}),
+    mw = IndexingMiddleware(index_storage=(WHOOSH_FILESTORAGE, (str(tmpdir / 'foo'), ), {}),
                             backend=backend)
     mw.create()
     mw.open()

MoinMoin/storage/middleware/_tests/test_validation.py

             keys.TAGS: [u"foo", u"bar"],
         }
 
-        state = {'trusted': False, # True for loading a serialized representation or other trusted sources
-                 keys.NAME: u'somename', # name we decoded from URL path
+        state = {'trusted': False,  # True for loading a serialized representation or other trusted sources
+                 keys.NAME: u'somename',  # name we decoded from URL path
                  keys.ACTION: u'SAVE',
                  keys.HOSTNAME: u'localhost',
                  keys.ADDRESS: u'127.0.0.1',
             keys.EMAIL: u"foo@example.org",
         }
 
-        state = {'trusted': False, # True for loading a serialized representation or other trusted sources
-                 keys.NAME: u'somename', # name we decoded from URL path
+        state = {'trusted': False,  # True for loading a serialized representation or other trusted sources
+                 keys.NAME: u'somename',  # name we decoded from URL path
                  keys.ACTION: u'SAVE',
                  keys.HOSTNAME: u'localhost',
                  keys.ADDRESS: u'127.0.0.1',

MoinMoin/storage/stores/_tests/test_all.py

 
 import pytest
 
+
 def test_getitem_raises(store):
     with pytest.raises(KeyError):
         store['doesnotexist']
     with pytest.raises(KeyError):
         store[k]
 
+
 def test_setitem_getitem_delitem_binary(store):
     k, v = 'key', '\000\001\002'
     store[k] = v

MoinMoin/storage/stores/_tests/test_kt.py

     store = Store()
     store.destroy()
 
+
 @pytest.mark.multi(Store=[BytesStore, FileStore])
 def test_from_uri(Store):
     store = Store.from_uri("localhost")

MoinMoin/storage/stores/_tests/test_memory.py

 
     return store
 
+
 @pytest.mark.multi(Store=[BytesStore, FileStore])
 def test_destroy(Store):
     store = test_create(Store)
     store.destroy()
     assert store._st is None
 
+
 @pytest.mark.multi(Store=[BytesStore, FileStore])
 def test_from_uri(Store):
     store = Store.from_uri("mem://")

MoinMoin/storage/stores/_tests/test_mongodb.py

     store.create()
     return store
 
+
 @pytest.mark.multi(Store=[BytesStore, FileStore])
 def test_destroy(Store):
     store = Store()
     store.destroy()
 
+
 @pytest.mark.multi(Store=[BytesStore, FileStore])
 def test_from_uri(Store):
     store = Store.from_uri("mongodb://localhost/test_base::test_coll")

MoinMoin/storage/stores/_tests/test_sqla.py

 pytest.importorskip('MoinMoin.storage.stores.sqla')
 from ..sqla import BytesStore, FileStore
 
+
 @pytest.mark.multi(Store=[BytesStore, FileStore])
 def test_create(tmpdir, Store):
     dbfile = tmpdir.join('store.sqlite')
     assert dbfile.check()
     return store
 
+
 @pytest.mark.multi(Store=[BytesStore, FileStore])
 def test_destroy(tmpdir, Store):
     dbfile = tmpdir.join('store.sqlite')
     store.destroy()
     # XXX: check for dropped table
 
+
 @pytest.mark.multi(Store=[BytesStore, FileStore])
 def test_from_uri(tmpdir, Store):
     store = Store.from_uri("sqlite://%s::test_base" % tmpdir)

MoinMoin/storage/stores/_tests/test_sqlite.py

 
 from ..sqlite import BytesStore, FileStore
 
+
 def bytes_compressed(path):
     return BytesStore(path, 'test_table', compression_level=1)
+
+
 def bytes_uncompressed(path):
     return BytesStore(path, 'test_table', compression_level=0)
 
+
 def file_compressed(path):
     return FileStore(path, 'test_table', compression_level=1)
+
+
 def file_uncompressed(path):
     return FileStore(path, 'test_table', compression_level=0)
 
+
 all_setups = pytest.mark.multi(Store=[
     bytes_uncompressed,
     bytes_compressed,
     assert dbfile.check()
     return store
 
+
 @all_setups
 def test_destroy(tmpdir, Store):
     dbfile = tmpdir.join('store.sqlite')
     store.destroy()
     # XXX: check for dropped table
 
+
 @pytest.mark.multi(Store=[BytesStore, FileStore])
 def test_from_uri(tmpdir, Store):
     store = Store.from_uri("%s::test_table::0" % tmpdir)

MoinMoin/themes/_tests/test_navi_bar.py

 from MoinMoin.themes import ThemeSupport
 from MoinMoin import themes
 
+
 class TestNaviBar(object):
     class Config(wikiconfig.Config):
         interwiki_map = dict(Self='http://localhost:8080/', MoinMoin='http://moinmo.in/', )
         expected = 'moin/moin-2.0'
         assert test_result == expected, ('Expected "%(expected)s" but got "%(test_result)s"') % locals()
 
+
 def test_shorten_item_name():
     test_result1 = themes.shorten_item_name(u'MoinMoin/some/value', 0)
     assert test_result1 == u'valu...lue'
     test_result3 = themes.shorten_item_name(u'MoinMoin/some/value')
     assert test_result3 == u'MoinMoin/some/value'
 
+
 def test_contenttype_to_class():
     test_result = themes.contenttype_to_class(u'MoinMoin/some/value')
     expected = u'moin-mime-MoinMoin'

MoinMoin/util/_tests/test_crypto.py

 
     def test_validtoken(self):
         """ validate the token """
-        test_key, test_token = crypto.generate_token(key='MoinMoin') # having some key value
+        test_key, test_token = crypto.generate_token(key='MoinMoin')  # having some key value
         result = crypto.valid_token(test_key, test_token)
         assert result
 
-        test_key, test_token = crypto.generate_token() # key value is none
+        test_key, test_token = crypto.generate_token()  # key value is none
         result = crypto.valid_token(test_key, test_token)
         assert result
 

MoinMoin/util/_tests/test_diff3.py

 
 from MoinMoin.util import diff3
 
+
 class TestDiff3:
 
     def testTextMerge(self):

MoinMoin/util/_tests/test_diff_html.py

 
 from MoinMoin.util import diff_html
 
+
 def test_indent():
     # input text
     test_input = """ \n
     result = diff_html.indent(test_input)
     assert result == expected
 
+
 def test_diff():
     test_input1 = """ \n
 

MoinMoin/util/_tests/test_diff_text.py

 
 from MoinMoin.util import diff_text
 
+
 class TestDiffText(object):
 
     def testDiff(self):

MoinMoin/util/_tests/test_filesys.py

     MoinMoin - MoinMoin.util.filesys Tests
 """
 
-import sys, os, time
-import shutil, tempfile
+import sys
+import os
+import time
+import shutil
+import tempfile
 
 import pytest
 
 win32_only = pytest.mark.skipif("sys.platform != 'win32'")
 win32_incompatible = pytest.mark.skipif("sys.platform == 'win32'")
 
+
 class TestFuid(object):
     """ test filesys.fuid (a better mtime() alternative for up-to-date checking) """
 
         self.makefile(self.fname, "foofoo")
         uid2 = filesys.fuid(self.fname)
 
-        assert uid2 != uid1 # we changed size and maybe mtime
+        assert uid2 != uid1  # we changed size and maybe mtime
 
     @win32_incompatible
     def testUpdateFileMovingFromTemp(self):
         os.rename(self.tmpname, self.fname)
         uid2 = filesys.fuid(self.fname)
 
-        assert uid2 != uid1 # we didn't change size, but inode and maybe mtime
+        assert uid2 != uid1  # we didn't change size, but inode and maybe mtime
 
     @win32_only
     def testStale(self):
         self.makefile(self.fname, "foo")
         uid1 = filesys.fuid(self.fname)
 
-        time.sleep(2) # thanks for waiting :)
+        time.sleep(2)  # thanks for waiting :)
         uid2 = filesys.fuid(self.fname, max_staleness=1)
         assert uid2 != uid1  # should be considered stale if platform has no inode support
 
         with pytest.raises(OSError):
             filesys.copytree(self.test_dir, self.test_dest_dir)
 
+
 coverage_modules = ['MoinMoin.util.filesys']

MoinMoin/util/_tests/test_forms.py

 
 test_attributes = {'type': 'submit', u'required': 'test_required', 'autofocus': None, 'placeholder': None}
 
+
 def test_label_filter():
     # when content is None
     result1 = forms.label_filter('test_tagname', test_attributes, None, 'test_context', test_bind)
     expected = 'new_content'
     assert result2 == expected
 
+
 def test_button_filter():
     result = forms.button_filter('test_tagname', test_attributes, 'new_content', 'test_context', None)
     expected = 'new_content'
     expected = 'test_bind_default'
     assert content_result == expected
 
+
 def test_required_filter():
     test_bind.optional = False
     test_attributes[u'class'] = 'test_class'
     expected = u'required'
     assert attribute_result == expected
 
+
 def test_autofocus_filter():
     test_bind.properties = {'autofocus': True}
     content_result = forms.autofocus_filter('test_tagname', test_attributes, 'new_content', 'test_context', test_bind)
     attribute_result = test_attributes[u'autofocus']
     assert attribute_result == u'autofocus'
 
+
 def test_placeholder_filter():
     test_bind.properties['placeholder'] = 'test_placeholder'
     content_result = forms.placeholder_filter('test_tagname', test_attributes, 'new_content', 'test_context', test_bind)
     attribute_result = test_attributes['placeholder']
     assert attribute_result == 'test_placeholder'
 
+
 def test_error_filter_factory():
     # when 'class' not in test_attributes
     test_bind.errors = 'test_errors'

MoinMoin/util/_tests/test_interwiki.py

 
 from __future__ import absolute_import, division
 
-import pytest
 import tempfile
 import os.path
 import shutil
 
+import pytest
+from flask import current_app as app
+
 from MoinMoin.util.interwiki import split_interwiki, join_wiki, InterWikiMap, url_for_item, _split_namespace
 from MoinMoin._tests import wikiconfig
 from MoinMoin.constants.keys import CURRENT
 from MoinMoin.app import before_wiki
 
-from flask import current_app as app
 
 class TestInterWiki(object):
     class Config(wikiconfig.Config):
         for (baseurl, pagename, namespace), url in tests:
             assert join_wiki(baseurl, pagename, namespace) == url
 
+
 class TestInterWikiMapBackend(object):
     """
     tests for interwiki map

MoinMoin/util/_tests/test_iri.py

 
 from MoinMoin.util.iri import *
 
+
 def test_Iri_init_1():
     u = Iri(scheme='wiki', path='/StartSeite', query='action=raw')
     assert u.scheme == 'wiki'
     assert u.query == 'action=raw'
     assert u.fragment is None
 
+
 def test_Iri_init_2():
     i = 'wiki://MoinMoin/StartSeite?action=raw#body'
     u = Iri(i, scheme='newwiki', path='/newStartSeite', query='action=false')
     assert u.query == 'action=false'
     assert u.fragment == 'body'
 
+
 def test_Iri_init_3():
     i = Iri(scheme='wiki', path='/StartSeite', query='action=raw')
     u = Iri(i)
     assert i is not u
     assert i == u
 
+
 def test_Iri_parser():
     i = 'http://moinmo.in/StartSeite?action=raw#body'
     u = Iri(i)
     assert u.fragment == 'body'
     assert unicode(u) == i
 
+
 def test_Iri_2():
     i = 'wiki://MoinMoin/StartSeite?action=raw#body'
     u = Iri(i)
     assert u.fragment == 'body'
     assert unicode(u) == i
 
+
 def test_Iri_3():
     i = 'wiki.local:StartSeite?action=raw#body'
     u = Iri(i)
     assert u.fragment == 'body'
     assert unicode(u) == i
 
+
 def test_Iri_add_1():
     base = Iri('wiki://moinmo.in/Some/Page?action=raw#body')
 
     assert u.query == 'action=raw'
     assert u.fragment == 'head'
 
+
 def test_Iri_quote_1():
-    u = Iri(scheme=u'wiki', authority=u'authority_ä%?#', path=u'/path_ä%?#', query=u'query_ä%?#', fragment=u'fragment_ä%?#')
+    u = Iri(scheme=u'wiki', authority=u'authority_ä%?#',
+            path=u'/path_ä%?#', query=u'query_ä%?#', fragment=u'fragment_ä%?#')
     assert u.scheme == u'wiki'
     assert u.authority == u'authority_ä%?#'
     authority = u'authority_ä%25%3F%23'
     assert u.fragment.urlquoted == u'fragment_%C3%A4%25?%23'
     assert unicode(u) == u'wiki://{0}{1}?{2}#{3}'.format(authority, path, query, fragment)
 
+
 def test_Iri_quote_2():
     authority = u'authority_ä%25%3F%23'
     path = u'/path_ä%25%3F%23'
     u = Iri(i)
     assert unicode(u) == i
 
+
 def test_Iri_quote_3():
     i = u'wiki:///path_%92%92'
     u = Iri(i)
     assert u.path.quoted == u'/path_%92%92'
     assert unicode(u) == i
 
+
 def test_IriAuthority_parser_1():
     i = 'moinmo.in'
     u = IriAuthority(i)
     assert u.port is None
     assert unicode(u) == i
 
+
 def test_IriAuthority_parser_2():
     i = '@moinmo.in:'
     u = IriAuthority(i)
     assert u.port == 0
     assert unicode(u) == i
 
+
 def test_IriAuthority_parser_3():
     i = 'test:test@moinmo.in:1234'
     u = IriAuthority(i)
     assert u.port == 1234
     assert unicode(u) == i
 
+
 def test_IriPath_1():
     i = '/'
     u = IriPath(i)
     assert u[1] == ''
     assert unicode(u) == i
 
+
 def test_IriPath_2():
     i = '/.'
     u = IriPath(i)
     assert u[1] == ''
     assert unicode(u) == '/'
 
+
 def test_IriPath_3():
     i = '/..'
     u = IriPath(i)
     assert u[1] == ''
     assert unicode(u) == '/'
 
+
 def test_IriPath_4():
     i = '/test'
     u = IriPath(i)
     assert u[1] == ''
     assert unicode(u) == '/'
 
+
 def test_IriPath_5():
     i = '/test/test1/../../test2'
     u = IriPath(i)

MoinMoin/util/_tests/test_mime.py

 
 from MoinMoin.util.mime import *
 
+
 def test_Type_init_1():
     t = Type(type='foo', subtype='bar', parameters={'foo': 'bar'})
     assert t.type == 'foo'
     assert t.subtype == 'bar'
     assert t.parameters == {'foo': 'bar'}
 
+