예제 #1
0
 def test_valid(self):
     self.assertEqual(trim_version("1.2.3", 1), "1")
     self.assertEqual(trim_version("1.2.3", 2), "1.2")
     self.assertEqual(trim_version("1.2.3", 3), "1.2.3")
     self.assertEqual(trim_version("1.2.3", 4), "1.2.3")
예제 #2
0
 def test_num_exception(self):
     with self.assertRaises(ValueError):
         trim_version("1.2.3", 0)
     with self.assertRaises(ValueError):
         trim_version("1.2.3", -1)
예제 #3
0
 def test_version_exception(self):
     with self.assertRaises(TypeError):
         trim_version(None, 2)
     with self.assertRaises(TypeError):
         trim_version((1, 2, 3), 2)
예제 #4
0
 def test_valid(self):
     self.assertEqual(trim_version("1.2.3", 1), "1")
     self.assertEqual(trim_version("1.2.3", 2), "1.2")
     self.assertEqual(trim_version("1.2.3", 3), "1.2.3")
     self.assertEqual(trim_version("1.2.3", 4), "1.2.3")
예제 #5
0
 def test_num_exception(self):
     with self.assertRaises(ValueError):
         trim_version("1.2.3", 0)
     with self.assertRaises(ValueError):
         trim_version("1.2.3", -1)
예제 #6
0
 def test_version_exception(self):
     with self.assertRaises(TypeError):
         trim_version(None, 2)
     with self.assertRaises(TypeError):
         trim_version((1, 2, 3), 2)