Exemplo n.º 1
0
    def make_candidates(self):
        C = namedtuple("C", "src, dst, expected")

        self.candidates = [
            C(src=self.semver, dst=Semver(1, 4, 2), expected=True),
            C(src=self.semver, dst=Semver(2, 4, 2), expected=False),
            C(src=self.semver, dst=Semver(1, 8, 2), expected=False),
            C(src=self.semver, dst=Semver(1, 4, 4), expected=False),
        ]
Exemplo n.º 2
0
    def make_candidates(self):
        C = namedtuple("C", "greater, less, expected")

        self.candidates = [
            C(greater=self.semver, less=Semver(0, 4, 2), expected=True),
            C(greater=self.semver, less=Semver(1, 2, 2), expected=True),
            C(greater=self.semver, less=Semver(1, 4, 0), expected=True),
            C(greater=self.semver, less=Semver(2, 4, 2), expected=False),
            C(greater=self.semver, less=Semver(1, 8, 2), expected=False),
            C(greater=self.semver, less=Semver(1, 4, 4), expected=False),
        ]
Exemplo n.º 3
0
 def test_整数型以外で初期化するとTypeErrorが返ってくること(self):
     with self.assertRaises(TypeError):
         Semver(major='1')
Exemplo n.º 4
0
 def test_プラスで初期化できること(self):
     self.assertEqual(1, Semver(major=1).major)
Exemplo n.º 5
0
 def setUp(self):
     self.semver = Semver(1, 4, 2)
Exemplo n.º 6
0
 def test_マイナスで初期化するとValueErrorが返ってくること(self):
     with self.assertRaises(ValueError):
         Semver(patch=-1)
Exemplo n.º 7
0
 def test_プラスで初期化できること(self):
     self.assertEqual(1, Semver(patch=1).patch)
Exemplo n.º 8
0
 def test_以上とより大きいが違うこと(self):
     self.assertTrue(self.semver >= Semver(1, 4, 2))
     self.assertFalse(self.semver > Semver(1, 4, 2))