File: test_ca.py

package info (click to toggle)
pyqonsole 0.2.0-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 448 kB
  • ctags: 647
  • sloc: python: 4,383; ansic: 111; makefile: 52; sh: 2
file content (66 lines) | stat: -rw-r--r-- 1,692 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Copyright (c) 2005-2006 LOGILAB S.A. (Paris, FRANCE).
# Copyright (c) 2005-2006 CEA Grenoble 
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the CECILL license, available at
# http://www.inria.fr/valorisation/logiciels/Licence.CeCILL-V2.pdf
#
import unittest
import sys
import os
sys.path.append(os.pardir)
from pyqonsole.ca import *


class CaTest(unittest.TestCase):
    """ Test of the Ca class.
    """

    def setUp(self):
        """ Setup a context before each test call.
        """
        self.c1 = Ca()
        self.c2 = Ca()

    def tearDown(self):
        """ Clear context after each test call.
        """
        del self.c1
        del self.c2

    def testInit(self):
        """ Test the __init__ method.
        """
        self.assertEqual(self.c1.c, u' ')
        self.assertEqual(self.c1.f, DEFAULT_FORE_COLOR)
        self.assertEqual(self.c1.b, DEFAULT_BACK_COLOR)
        self.assertEqual(self.c1.r, DEFAULT_RENDITION)

    def testEqual(self):
        """ Test the __eq__ method.
        """
        self.assertEqual(self.c1, self.c2)
        
    def testNotEqualC(self):
        """ Test the __ne__ method.
        """
        self.c2.c = 'a'
        self.assertNotEqual(self.c1, self.c2)
        
    def testNotEqualF(self):
        """ Test the __ne__ method.
        """
        self.c2.f = 1
        self.assertNotEqual(self.c1, self.c2)
        
        
    def testNotEqualR(self):
        """ Test the __ne__ method.
        """
        self.c2.r = 1
        self.assertNotEqual(self.c1, self.c2)


if __name__ == "__main__":
    unittest.main()