Пример #1
0
 def test_get_broad_raise_value_error(self):
     # if not in format "50.0%" raise value error
     with self.assertRaises(ValueError):
         picture_cross.get_broad("abc", [(0, 0), (0, 1)], [(0, 0), (0, 2)],
                                 False)
     with self.assertRaises(ValueError):
         picture_cross.get_broad("10%1", [(0, 0), (0, 1)], [(0, 0), (0, 2)],
                                 False)
Пример #2
0
 def test_get_broad_relative_rev_same_length(self):
     broad = "100%"
     broad_short, broad_long = picture_cross.get_broad(
         broad, [(1, 1), (0, 0)], [(2, 2), (0, 0)], True)
     res = 0.7071067811865476
     self.assertSequenceEqual([broad_short, broad_long], [res * 2, res * 2])
Пример #3
0
 def test_get_broad_relative_y_same_length(self):
     broad = "100%"
     broad_short, broad_long = picture_cross.get_broad(
         broad, [(0, 0), (0, 1)], [(0, 0), (0, 2)], True)
     self.assertSequenceEqual([broad_short, broad_long], [1., 1.])
Пример #4
0
 def test_get_broad_relative_y(self):
     broad = "100%"
     broad_short, broad_long = picture_cross.get_broad(
         broad, [(0, 0), (0, 1)], [(0, 0), (0, 2)], False)
     self.assertSequenceEqual([broad_short, broad_long], [1., 2.])
Пример #5
0
 def test_get_broad_relative(self):
     broad = "100%"
     broad_short, broad_long = picture_cross.get_broad(
         broad, [(0, 0), (1, 1)], [(0, 0), (2, 2)], False)
     res = 0.7071067811865476
     self.assertSequenceEqual([broad_short, broad_long], [res * 2, res * 4])
Пример #6
0
 def test_get_broad_total_2(self):
     broad = -2
     broad_short, broad_long = picture_cross.get_broad(broad, [], [], False)
     self.assertSequenceEqual([broad_short, broad_long], [-2, -2])
Пример #7
0
 def test_get_broad_total(self):
     broad = 10
     broad_short, broad_long = picture_cross.get_broad(broad, [], [], False)
     self.assertSequenceEqual([broad_short, broad_long], [10, 10])