Exemple #1
0
def main():
    try:
        x1, x2 = ast.literal_eval(
            input('Enter co-ordinates for line 1 using comma separated: '))
        x3, x4 = ast.literal_eval(
            input('Enter co-ordinates for line 2 using comma separated: '))
        line1 = (x1, x2)
        line2 = (x3, x4)
        result = overlap(line1, line2)
        print(result)
    except (ValueError, SyntaxError):
        print(
            'Invalid co-ordinates, please enter 2 numbers with comma separated'
        )
Exemple #2
0
 def test_pos_int_overlap(self):
     line1 = (1, 2)
     line2 = (1, 4)
     result = overlap(line1, line2)
     self.assertEqual(result,
                      '{} and {} overlaps on x-axis'.format(line1, line2))
Exemple #3
0
 def test_conv_str_coord(self):
     line1 = ('1', 2)
     line2 = (2, '3.4')
     result = overlap(line1, line2)
     self.assertEqual(result, '{} and {} overlaps on x-axis'.format((1, 2),
                                                                    (2, 3)))
Exemple #4
0
 def test_comb_int_not_overlap(self):
     line1 = (-3, -4)
     line2 = (1, 2)
     result = overlap(line1, line2)
     self.assertEqual(
         result, '{} and {} not overlaps on x-axis'.format(line1, line2))
Exemple #5
0
 def test_neg_int_overlap(self):
     line1 = (-1, -3)
     line2 = (-2, -4)
     result = overlap(line1, line2)
     self.assertEqual(result,
                      '{} and {} overlaps on x-axis'.format(line1, line2))