Konstantine Rybnikov avatar Konstantine Rybnikov committed bfa84fa

oh, now I remember why I needed __eq__ on Diff

Comments (0)

Files changed (2)


     def __unicode__(self):
         """Gives a nice text representation of what happened."""
+        return self.represent(compact=True)
+    def represent(self, compact=False):
         def esc_chunk(s, maxlen):
             """Escapes chunk's ``\\n`` symbols etc. and returns a chunk
             of that.
         rv = StringBuilder()
+        list_prefix = u"    * "
         if len(self.operation_to_storage_map['add']):
             rv += _(u"Added phrases:\n")
-            list_prefix = u"    * "
             for item in self.operation_to_storage_map['add']:
                 rv += u"%s%s\n" % (list_prefix,
     def __eq__(self, other):
+def compare_two_pofiles(pofile1, pofile2):
+    """Returns :class:`~Diff` object that represents difference between two po
+    files.
+    ``pofile1``, ``pofile2``
+        :class:`~polib.POFile` instances.
+    """
+    pass


 import unittest
-from fat_po_editor.diffutil import Diff
-from polib import POEntry
+from polib import POEntry, POFile
+from fat_po_editor.diffutil import Diff, compare_two_pofiles
 class TestDiffUtilDiff(unittest.TestCase):
     def test_append_simple(self):
         diff2 = Diff()
         self.assertEquals(diff1 == diff2, True)
+class TestCompareTwoPofiles(unittest.TestCase):
+    def test_empty(self):
+        f1 = POFile()
+        f2 = POFile()
+        self.assertEquals(compare_two_pofiles(f1, f2),
+                          Diff())
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.