[Checkins] SVN: zope.fixers/trunk/zope/fixers/ Yet more indentation fixes...
Lennart Regebro
regebro at gmail.com
Tue Apr 7 05:25:50 EDT 2009
Log message for revision 98970:
Yet more indentation fixes...
Changed:
U zope.fixers/trunk/zope/fixers/fix_implements.py
U zope.fixers/trunk/zope/fixers/tests.py
-=-
Modified: zope.fixers/trunk/zope/fixers/fix_implements.py
===================================================================
--- zope.fixers/trunk/zope/fixers/fix_implements.py 2009-04-07 08:58:59 UTC (rev 98969)
+++ zope.fixers/trunk/zope/fixers/fix_implements.py 2009-04-07 09:25:50 UTC (rev 98970)
@@ -131,15 +131,21 @@
# Take the current class constructor prefix, and stick it into
# the decorator, to set the decorators indentation.
+ #import pdb;pdb.set_trace()
prefix = node.get_prefix()
decorator.set_prefix(prefix)
# Then find the last line of the previous node and use that as
# indentation, and add that to the class constructors prefix.
prefix = str(node.get_prev_sibling())
- if '\n' in prefix:
- prefix = prefix[prefix.rfind('\n')+1:]
- prefix = '\n' + prefix + node.get_prefix()
+ if not prefix:
+ prefix = node.get_prefix()
+ elif '\n' in prefix:
+ prefix = prefix[prefix.rfind('\n')+1:] + node.get_prefix()
+ else:
+ prefix = prefix + node.get_prefix()
+ if not prefix or prefix[0] != '\n':
+ prefix = '\n' + prefix
node.set_prefix(prefix)
node.insert_child(0, decorator)
Modified: zope.fixers/trunk/zope/fixers/tests.py
===================================================================
--- zope.fixers/trunk/zope/fixers/tests.py 2009-04-07 08:58:59 UTC (rev 98969)
+++ zope.fixers/trunk/zope/fixers/tests.py 2009-04-07 09:25:50 UTC (rev 98970)
@@ -244,6 +244,15 @@
class myint(int):
implements(I2)
+ def test_implementedBy(self):
+ class I2(I1): pass
+
+ class C1(Odd):
+ implements(I2)
+
+ class C2(C1):
+ implements(I3)
+
"""
edge_cases_target = """
@@ -263,6 +272,17 @@
class myint(int):
pass
+ def test_implementedBy(self):
+ class I2(I1): pass
+
+ @implementer(I2)
+ class C1(Odd):
+ pass
+
+ @implementer(I3)
+ class C2(C1):
+ pass
+
"""
class FixerTest(unittest.TestCase):
More information about the Checkins
mailing list