Ejemplo n.º 1
0
 def test_validate_envelope_sides(self, name, side_a, side_b, exp_res):
     act_res = (TaskValidator.validate_envelope_sides(side_a, side_b))
     try:
         self.assertEqual(act_res[0], exp_res[0])
         self.assertEqual(act_res[1], exp_res[1])
     except AssertionError as e:
         msg = "\nFail test - \"{0}\"; Input data - {1}; Error{2}".format(
             name, (side_a, side_b), e)
         raise AssertionError(msg)
Ejemplo n.º 2
0
def input_envelope():
    """
    Input data for create one envelope send data into validator
    :return: Envelope|raise UserExitError
    """
    flag = True
    while flag:
        print("Please input the first side")
        a_side = input()
        print("Please input the second side")
        b_side = input()
        validation_res = TaskValidator.validate_envelope_sides(a_side, b_side)
        if validation_res[0]:
            return Envelope(float(a_side), float(b_side))
        print(validation_res[1])
        flag = do_continue()

    raise UserExitError("User exit")