aboutsummaryrefslogtreecommitdiff
path: root/python/dep_label_TEST.py
blob: 91130e74221f6c8726b94b352711d63804d5da12 (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env python
# vim: set fileencoding=utf-8 sw=4 sts=4 et :

#
# Copyright (c) 2007 Piotr JaroszyƄski
#
# This file is part of the Paludis package manager. Paludis is free software;
# you can redistribute it and/or modify it under the terms of the GNU General
# Public License version 2, as published by the Free Software Foundation.
#
# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA  02111-1307  USA
#

from paludis import *
import unittest

class TestCase_01_URILabels(unittest.TestCase):
    def setUp(self):
        self.list = []
        self.list.append(URIMirrorsThenListedLabel("foo"))
        self.list.append(URIMirrorsOnlyLabel("foo"))
        self.list.append(URIListedOnlyLabel("foo"))
        self.list.append(URIListedThenMirrorsLabel("foo"))
        self.list.append(URILocalMirrorsOnlyLabel("foo"))
        self.list.append(URIManualOnlyLabel("foo"))

    def test_01_no_create(self):
        self.assertRaises(Exception, URILabel)

    def test_02_inheritance(self):
        for l in self.list:
            self.assert_(isinstance(l, URILabel))

    def test_03_text(self):
        for l in self.list:
            self.assert_(l.text, "foo")

    def test_04_str(self):
        for l in self.list:
            self.assert_(str(l), "foo")

class TestCase_02_DependencyLabels(unittest.TestCase):
    def setUp(self):
        self.list = []
        self.list.append((DependencyHostLabel("foo"), DependencySystemLabel))
        self.list.append((DependencyTargetLabel("foo"), DependencySystemLabel))
        self.list.append((DependencyBuildLabel("foo"), DependencyTypeLabel))
        self.list.append((DependencyRunLabel("foo"), DependencyTypeLabel))
        self.list.append((DependencyInstallLabel("foo"), DependencyTypeLabel))
        self.list.append((DependencyCompileLabel("foo"), DependencyTypeLabel))
        self.list.append((DependencySuggestedLabel("foo"), DependencySuggestLabel))
        self.list.append((DependencyRecommendedLabel("foo"), DependencySuggestLabel))
        self.list.append((DependencyRequiredLabel("foo"), DependencySuggestLabel))
        self.list.append((DependencyAnyLabel("foo"), DependencyABIsLabel))
        self.list.append((DependencyMineLabel("foo"), DependencyABIsLabel))
        self.list.append((DependencyPrimaryLabel("foo"), DependencyABIsLabel))
        self.list.append((DependencyABILabel("foo"), DependencyABIsLabel))

    def test_01_no_create(self):
        self.assertRaises(Exception, DependencyLabel)
        self.assertRaises(Exception, DependencySystemLabel)
        self.assertRaises(Exception, DependencyTypeLabel)
        self.assertRaises(Exception, DependencySuggestLabel)
        self.assertRaises(Exception, DependencyABIsLabel)

    def test_02_inheritance(self):
        for t in self.list:
            self.assert_(isinstance(t[0], DependencyLabel))
            self.assert_(isinstance(t[0], t[1]))

    def test_03_text(self):
        for t in self.list:
            self.assert_(t[0].text, "foo")

    def test_04_str(self):
        for t in self.list:
            self.assert_(str(t[0]), "foo")


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