1# -*- coding: utf-8 -*-
2
3
4from __future__ import absolute_import
5from __future__ import unicode_literals
6
7import dnf.exceptions
8
9from .common import TestCase
10
11
12class DnfExceptionsApiTest(TestCase):
13
14    def test_deprectation_warning(self):
15        # dnf.exceptions.DeprecationWarning
16        self.assertHasAttr(dnf.exceptions, "DeprecationWarning")
17        self.assertHasType(dnf.exceptions.DeprecationWarning(), DeprecationWarning)
18
19    def test_error(self):
20        # dnf.exceptions.Error
21        self.assertHasAttr(dnf.exceptions, "Error")
22        ex = dnf.exceptions.Error(value=None)
23        self.assertHasType(ex, Exception)
24
25    def test_comps_error(self):
26        # dnf.exceptions.CompsError
27        self.assertHasAttr(dnf.exceptions, "CompsError")
28        ex = dnf.exceptions.CompsError(value=None)
29        self.assertHasType(ex, dnf.exceptions.Error)
30
31    def test_depsolve_error(self):
32        # dnf.exceptions.DepsolveError
33        self.assertHasAttr(dnf.exceptions, "DepsolveError")
34        ex = dnf.exceptions.DepsolveError(value=None)
35        self.assertHasType(ex, dnf.exceptions.Error)
36
37    def test_download_error(self):
38        # dnf.exceptions.DownloadError
39        self.assertHasAttr(dnf.exceptions, "DownloadError")
40        ex = dnf.exceptions.DownloadError(errmap=None)
41        self.assertHasType(ex, dnf.exceptions.Error)
42
43    def test_marking_error(self):
44        # dnf.exceptions.MarkinError
45        self.assertHasAttr(dnf.exceptions, "MarkingError")
46        ex = dnf.exceptions.MarkingError(value=None, pkg_spec=None)
47        self.assertHasType(ex, dnf.exceptions.Error)
48
49    def test_marking_errors(self):
50        # dnf.exceptions.MarkinErrors
51        self.assertHasAttr(dnf.exceptions, "MarkingErrors")
52        ex = dnf.exceptions.MarkingErrors(
53            no_match_group_specs=(),
54            error_group_specs=(),
55            no_match_pkg_specs=(),
56            error_pkg_specs=(),
57            module_depsolv_errors=()
58        )
59        self.assertHasType(ex, dnf.exceptions.Error)
60
61    def test_repo_error(self):
62        # dnf.exceptions.RepoError
63        self.assertHasAttr(dnf.exceptions, "RepoError")
64        ex = dnf.exceptions.RepoError()
65        self.assertHasType(ex, dnf.exceptions.Error)
66