Ejemplo n.º 1
0
 def test_whitespace(self):
     unit = MockUnit(source='Foo\n')
     fix = SameBookendingWhitespace()
     self.assertEqual(fix.fix_target(['Bar'], unit), (['Bar\n'], True))
     self.assertEqual(fix.fix_target(['Bar\n'], unit), (['Bar\n'], False))
     unit = MockUnit(source=' ')
     self.assertEqual(fix.fix_target(['  '], unit), (['  '], False))
Ejemplo n.º 2
0
 def test_whitespace(self):
     unit = MockUnit(source="Foo\n")
     fix = SameBookendingWhitespace()
     self.assertEqual(fix.fix_target(["Bar"], unit), (["Bar\n"], True))
     self.assertEqual(fix.fix_target(["Bar\n"], unit), (["Bar\n"], False))
     unit = MockUnit(source=" ")
     self.assertEqual(fix.fix_target(["  "], unit), (["  "], False))
Ejemplo n.º 3
0
 def test_whitespace(self):
     unit = MockUnit(source="Foo\n")
     fix = SameBookendingWhitespace()
     self.assertEqual(fix.fix_target(["Bar"], unit), (["Bar\n"], True))
     self.assertEqual(fix.fix_target(["Bar\n"], unit), (["Bar\n"], False))
     unit = MockUnit(source=" ")
     self.assertEqual(fix.fix_target(["  "], unit), (["  "], False))
Ejemplo n.º 4
0
 def test_no_whitespace(self):
     unit = MockUnit(source='Foo')
     fix = SameBookendingWhitespace()
     self.assertEqual(
         fix.fix_target(['Bar'], unit),
         (['Bar'], False)
     )
     self.assertEqual(
         fix.fix_target(['Bar\n'], unit),
         (['Bar'], True)
     )
Ejemplo n.º 5
0
 def test_whitespace_flags(self):
     fix = SameBookendingWhitespace()
     unit = MockUnit(source='str', flags='ignore-start-space')
     self.assertEqual(
         fix.fix_target(['  str'], unit),
         (['  str'], False)
     )
     unit = MockUnit(source='str', flags='ignore-end-space')
     self.assertEqual(
         fix.fix_target(['  str  '], unit),
         (['str  '], True)
     )
Ejemplo n.º 6
0
 def test_whitespace(self):
     unit = Unit(source=u'Foo\n')
     fix = SameBookendingWhitespace()
     self.assertEqual(
         fix.fix_target(['Bar'], unit),
         ([u'Bar\n'], True)
     )
     self.assertEqual(
         fix.fix_target(['Bar\n'], unit),
         ([u'Bar\n'], False)
     )
     unit = Unit(source=u' ')
     self.assertEqual(
         fix.fix_target(['  '], unit),
         (['  '], False)
     )
Ejemplo n.º 7
0
 def test_whitespace_flags(self):
     fix = SameBookendingWhitespace()
     unit = MockUnit(source='str', flags='ignore-start-space')
     self.assertEqual(fix.fix_target(['  str'], unit), (['  str'], False))
     unit = MockUnit(source='str', flags='ignore-end-space')
     self.assertEqual(fix.fix_target(['  str  '], unit), (['str  '], True))
Ejemplo n.º 8
0
 def test_whitespace_flags(self):
     fix = SameBookendingWhitespace()
     unit = MockUnit(source="str", flags="ignore-begin-space")
     self.assertEqual(fix.fix_target(["  str"], unit), (["  str"], False))
     unit = MockUnit(source="str", flags="ignore-end-space")
     self.assertEqual(fix.fix_target(["  str  "], unit), (["str  "], True))
Ejemplo n.º 9
0
 def test_no_whitespace(self):
     unit = Unit(source=u'Foo')
     fix = SameBookendingWhitespace()
     self.assertEqual(fix.fix_target(['Bar'], unit), ([u'Bar'], False))
     self.assertEqual(fix.fix_target(['Bar\n'], unit), ([u'Bar'], True))