def test_for_compile_error():
 try:
  can_compile(u'(fn [] (for)')
 except LexException as e:
  assert (e.message == u'Premature end of input')
 else:
  assert False
 try:
  can_compile(u'(fn [] (for)))')
 except LexException as e:
  assert (e.message == u"Ran into a RPAREN where it wasn't expected.")
 else:
  assert False
 try:
  can_compile(u'(fn [] (for [x] x))')
 except HyTypeError as e:
  assert (e.message == u"`for' requires an even number of args.")
 else:
  assert False
 try:
  can_compile(u'(fn [] (for [x xx]))')
 except HyTypeError as e:
  assert (e.message == u"`for' requires a body to evaluate")
 else:
  assert False
 try:
  can_compile(u'(fn [] (for [x xx] (else 1)))')
 except HyTypeError as e:
  assert (e.message == u"`for' requires a body to evaluate")
 else:
  assert False

def test_for_compile_error ( ) : try : can_compile ( u'(fn [] (for)' ) except LexException as e : assert ( e . message == u'Premature end of input' ) else : assert False try : can_compile ( u'(fn [] (for)))' ) except LexException as e : assert ( e . message == u"Ran into a RPAREN where it wasn't expected." ) else : assert False try : can_compile ( u'(fn [] (for [x] x))' ) except HyTypeError as e : assert ( e . message == u"`for' requires an even number of args." ) else : assert False try : can_compile ( u'(fn [] (for [x xx]))' ) except HyTypeError as e : assert ( e . message == u"`for' requires a body to evaluate" ) else : assert False try : can_compile ( u'(fn [] (for [x xx] (else 1)))' ) except HyTypeError as e : assert ( e . message == u"`for' requires a body to evaluate" ) else : assert False
ensure we get compile error in tricky for cases .