test_section.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # This program is free software; you can redistribute it and/or modify
  2. # it under the terms of the GNU General Public License as published by
  3. # the Free Software Foundation; either version 2 of the License, or
  4. # (at your option) any later version.
  5. # This program is distributed in the hope that it will be useful,
  6. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. # GNU General Public License for more details.
  9. # You should have received a copy of the GNU General Public License
  10. # along with this program; if not, write to the Free Software
  11. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  12. ################################################################################
  13. import pytest
  14. from .section import Section
  15. def test_Section(session):
  16. obj = Section('section')
  17. session.add(obj)
  18. session.flush()
  19. get = Section.get(1, session)
  20. assert get
  21. assert get.section == 'section'
  22. def test_Section___eq__():
  23. obj = Section('section')
  24. with pytest.warns(DeprecationWarning):
  25. assert obj == 'section'
  26. with pytest.warns(DeprecationWarning):
  27. assert 'section' == obj
  28. def test_Section___ne__():
  29. obj = Section('section')
  30. with pytest.warns(DeprecationWarning):
  31. assert obj != 'zzzz'
  32. with pytest.warns(DeprecationWarning):
  33. assert 'zzzz' != obj