Ignore:
Timestamp:
8 Jan 2015, 14:25:54 (10 years ago)
Author:
uli
Message:

Make tests work again.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/schoolgrades.py

    r12424 r12426  
    2929
    3030
     31#: A unique default value.
     32DEFAULT_VALUE = object()
     33
     34
    3135class ResultEntry(grok.Model):
    3236    """A result entry contains a subject and a grade.
     
    4549
    4650    def __eq__(self, obj):
    47         default = object()
    48         result = []
     51        """Two ResultEntry objects are equal if their `subject` and
     52           `grade` are equal.
     53        """
    4954        for name in ('subject', 'grade',):
    50             result.append(
    51                 getattr(self, name) == getattr(obj, name, default))
    52         return False not in result
     55            if getattr(self, name) != getattr(obj, name, DEFAULT_VALUE):
     56                return False
     57        return True
     58
     59    def __ne__(self, other):
     60        """Two ResultEntries are not equal, if their equality test fails.
     61
     62        a != b <-> not(a == b). Python doc tell, that __ne__ should
     63        also be rovided, whenever __eq__ is implemented.
     64        """
     65        return not self.__eq__(other)
    5366
    5467    def to_string(self):
Note: See TracChangeset for help on using the changeset viewer.