test_decider.py 3.53 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
import unittest

from apprecommender.decider import PkgInitDecider


class PkgInitDeciderTests(unittest.TestCase):

    def setUp(self):
        self.pkg_init_decider = PkgInitDecider()

    def test_python_pkg_regex(self):
        pkg = 'python-test'
        self.assertTrue(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

        pkg = 'python3-test'
        self.assertTrue(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

18
        pkg = 'test-pkg'
19 20 21 22 23 24
        self.assertFalse(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

    def test_ruby_pkg_regex(self):
        pkg = 'ruby-test'
        self.assertTrue(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

25
        pkg = 'test-pkg'
26 27 28 29 30 31
        self.assertFalse(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

    def test_texlive_pkg_regex(self):
        pkg = 'texlive-test'
        self.assertTrue(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

32
        pkg = 'test-pkg'
33 34 35 36 37 38
        self.assertFalse(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

    def test_pkg_gir_regex(self):
        pkg = 'gir1.2-test'
        self.assertTrue(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

39
        pkg = 'test-pkg'
40 41 42 43 44 45
        self.assertFalse(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

    def test_pkg_golang_regex(self):
        pkg = 'golang-test'
        self.assertTrue(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

46
        pkg = 'test-pkg'
47 48 49 50 51 52
        self.assertFalse(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

    def test_pkg_data_regex(self):
        pkg = 'test-data'
        self.assertTrue(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

53
        pkg = 'test-pkg'
54 55 56 57 58 59
        self.assertFalse(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

    def test_pkg_dev_regex(self):
        pkg = 'test-dev'
        self.assertTrue(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

60
        pkg = 'test-pkg'
61 62 63 64 65 66 67 68 69
        self.assertFalse(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

    def test_pkg_utils_regex(self):
        pkg = 'test-utils'
        self.assertTrue(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

        pkg = 'test-utils-1.9'
        self.assertTrue(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

70
        pkg = 'test-pkg'
71 72 73 74 75 76
        self.assertFalse(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

    def test_pkg_common_regex(self):
        pkg = 'test-common'
        self.assertTrue(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

77
        pkg = 'test-pkg'
78 79 80 81 82 83
        self.assertFalse(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

    def test_pkg_fonts_regex(self):
        pkg = 'test-fonts'
        self.assertTrue(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
        pkg = 'test-pkg'
        self.assertFalse(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

    def test_pkg_png_regex(self):
        pkg = 'test-png'
        self.assertTrue(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

        pkg = 'test-pkg'
        self.assertFalse(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

    def test_pkg_core_regex(self):
        pkg = 'test-core'
        self.assertTrue(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

        pkg = 'test-pkg'
        self.assertFalse(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

    def test_pkg_default_regex(self):
        pkg = 'test-default'
        self.assertTrue(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))

        pkg = 'test-pkg'
106
        self.assertFalse(self.pkg_init_decider.is_pkg_a_prefix_or_suffix(pkg))