~sylvain-pineau/checkbox-core/bug983035

« back to all changes in this revision

Viewing changes to checkbox/journal/tests/test_score.py

  • Committer: Marc Tardif
  • Date: 2012-04-12 18:58:39 UTC
  • Revision ID: marc.tardif@canonical.com-20120412185839-5lxr7972gntlpl2z
Added journal component.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Copyright (c) 2012 Canonical
 
3
#
 
4
# This file is part of Checkbox.
 
5
#
 
6
# Storm is free software; you can redistribute it and/or modify
 
7
# it under the terms of the GNU Lesser General Public License as
 
8
# published by the Free Software Foundation; either version 2.1 of
 
9
# the License, or (at your option) any later version.
 
10
#
 
11
# Storm is distributed in the hope that it will be useful,
 
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
# GNU Lesser General Public License for more details.
 
15
#
 
16
# You should have received a copy of the GNU Lesser General Public License
 
17
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
#
 
19
__metaclass__ = type
 
20
 
 
21
__all__ = []
 
22
 
 
23
from unittest import TestCase
 
24
 
 
25
from checkbox.journal.score import Score
 
26
 
 
27
 
 
28
class TestScore(TestCase):
 
29
 
 
30
    def test_init(self):
 
31
        score = Score()
 
32
        score = Score(0)
 
33
        score = Score(1)
 
34
 
 
35
    def test_cmp(self):
 
36
        a = Score()
 
37
        b = Score()
 
38
        self.assertEquals(cmp(a, b), 0)
 
39
 
 
40
        a.value = 1
 
41
        self.assertEquals(cmp(a, b), 1)
 
42
        self.assertEquals(cmp(1, b), 1)
 
43
 
 
44
        b.value = 2
 
45
        self.assertEquals(cmp(a, b), -1)
 
46
        self.assertEquals(cmp(a, 2), -1)