builtin_round_int.py 427 B

123456789101112131415161718
  1. # test round() with integer values and second arg
  2. # rounding integers is an optional feature so test for it
  3. try:
  4. round(1, -1)
  5. except NotImplementedError:
  6. print('SKIP')
  7. raise SystemExit
  8. tests = [
  9. (1, False), (1, True),
  10. (124, -1), (125, -1), (126, -1),
  11. (5, -1), (15, -1), (25, -1),
  12. (12345, 0), (12345, -1), (12345, 1),
  13. (-1234, 0), (-1234, -1), (-1234, 1),
  14. ]
  15. for t in tests:
  16. print(round(*t))