You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 line
971B

  1. # test_stats.py
  2. # Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
  3. #
  4. # This module is part of GitPython and is released under
  5. # the BSD License: http://www.opensource.org/licenses/bsd-license.php
  6. from git.test.lib import (
  7. TestBase,
  8. fixture,
  9. assert_equal
  10. )
  11. from git import Stats
  12. from git.compat import defenc
  13. class TestStats(TestBase):
  14. def test_list_from_string(self):
  15. output = fixture('diff_numstat').decode(defenc)
  16. stats = Stats._list_from_string(self.rorepo, output)
  17. assert_equal(2, stats.total['files'])
  18. assert_equal(52, stats.total['lines'])
  19. assert_equal(29, stats.total['insertions'])
  20. assert_equal(23, stats.total['deletions'])
  21. assert_equal(29, stats.files["a.txt"]['insertions'])
  22. assert_equal(18, stats.files["a.txt"]['deletions'])
  23. assert_equal(0, stats.files["b.txt"]['insertions'])
  24. assert_equal(5, stats.files["b.txt"]['deletions'])