~computer-janitor-hackers/systemcleaner/intrepid-sru-1-proposal

3 by Lars Wirzenius
Added copyright statements everywhere. Yay! Legalese!
1
# exc_tests.py - unit tests for exc.py
2
# Copyright (C) 2008  Canonical, Ltd.
3
#
4
# This program is free software: you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation, either version 3 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17
2 by Lars Wirzenius
Some initial files.
18
import unittest
19
21 by Lars Wirzenius
Rename systemcleanerlib to systemcleaner.
20
import systemcleaner
2 by Lars Wirzenius
Some initial files.
21
22
23
class SystemCleanerExceptionTests(unittest.TestCase):
24
25
    def testReturnsStrCorrectly(self):
21 by Lars Wirzenius
Rename systemcleanerlib to systemcleaner.
26
        e = systemcleaner.Exception()
2 by Lars Wirzenius
Some initial files.
27
        e._str = "pink"
31.1.18 by Lars Wirzenius
Use assert* methods instead of failUnless* methods, since that seems to be the preferred Python style.
28
        self.assertEqual(str(e), "pink")
2 by Lars Wirzenius
Some initial files.
29
30
31
class UnimplementedMethodTests(unittest.TestCase):
32
33
    def testErrorMessageContainsMethodName(self):
21 by Lars Wirzenius
Rename systemcleanerlib to systemcleaner.
34
        e = systemcleaner.UnimplementedMethod(self.__init__)
31.1.18 by Lars Wirzenius
Use assert* methods instead of failUnless* methods, since that seems to be the preferred Python style.
35
        self.assert_("__init__" in str(e))