コード例 #1
0
ファイル: test_autofix.py プロジェクト: wellart/weblate
 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))
コード例 #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))
コード例 #3
0
ファイル: test_autofix.py プロジェクト: wellart/weblate
 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))
コード例 #4
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))
コード例 #5
0
ファイル: test_autofix.py プロジェクト: phewcentral/weblate
 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))