mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-24 17:16:12 +01:00
- refactor assertEqualMultiline into common.py for reuse
This will be reused by the tests for the imminent prdiff subcommand.
This commit is contained in:
parent
33f3ab4203
commit
9b1c6f0204
@ -157,3 +157,13 @@ class OscTestCase(unittest.TestCase):
|
||||
continue
|
||||
self.assertTrue(os.path.exists(os.path.join('.osc', i.get('name'))))
|
||||
self.assertEqual(osc.core.dgst(os.path.join('.osc', i.get('name'))), i.get('md5'))
|
||||
|
||||
def assertEqualMultiline(self, got, exp):
|
||||
if (got + exp).find('\n') == -1:
|
||||
self.assertEqual(got, exp)
|
||||
else:
|
||||
start_delim = "\n" + (" 8< ".join(["-----"] * 8)) + "\n"
|
||||
end_delim = "\n" + (" >8 ".join(["-----"] * 8)) + "\n\n"
|
||||
self.assertEqual(got, exp,
|
||||
"got:" + start_delim + got + end_delim +
|
||||
"expected:" + start_delim + exp + end_delim)
|
||||
|
@ -329,15 +329,7 @@ Binary file 'binary' has changed.
|
||||
|
||||
got = __canonise_diff(got)
|
||||
exp = __canonise_diff(exp)
|
||||
|
||||
if (got + exp).find('\n') == -1:
|
||||
self.assertEqual(got, exp)
|
||||
else:
|
||||
start_delim = "\n" + (" 8< ".join(["-----"] * 8)) + "\n"
|
||||
end_delim = "\n" + (" >8 ".join(["-----"] * 8)) + "\n\n"
|
||||
self.assertEqual(got, exp,
|
||||
"got:" + start_delim + got + end_delim +
|
||||
"expected:" + start_delim + exp + end_delim)
|
||||
self.assertEqualMultiline(got, exp)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import unittest
|
||||
|
Loading…
Reference in New Issue
Block a user