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.

38 line
1.2KB

  1. # test_actor.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 assert_equal
  7. from git import Actor
  8. class TestActor(object):
  9. def test_from_string_should_separate_name_and_email(self):
  10. a = Actor._from_string("Michael Trier <mtrier@example.com>")
  11. assert_equal("Michael Trier", a.name)
  12. assert_equal("mtrier@example.com", a.email)
  13. # base type capabilities
  14. assert a == a
  15. assert not (a != a)
  16. m = set()
  17. m.add(a)
  18. m.add(a)
  19. assert len(m) == 1
  20. def test_from_string_should_handle_just_name(self):
  21. a = Actor._from_string("Michael Trier")
  22. assert_equal("Michael Trier", a.name)
  23. assert_equal(None, a.email)
  24. def test_should_display_representation(self):
  25. a = Actor._from_string("Michael Trier <mtrier@example.com>")
  26. assert_equal('<git.Actor "Michael Trier <mtrier@example.com>">', repr(a))
  27. def test_str_should_alias_name(self):
  28. a = Actor._from_string("Michael Trier <mtrier@example.com>")
  29. assert_equal(a.name, str(a))