github.com/grumpyhome/grumpy@v0.3.1-0.20201208125205-7b775405bdf1/grumpy-runtime-src/testing/file_test.py (about)

     1  f = open('/tmp/file_test__someunlikelyexistingfile', 'w')
     2  assert f.softspace == 0
     3  
     4  f.softspace = 1
     5  assert f.softspace == 1
     6  
     7  try:
     8      f.softspace = '4321'     # should not be converted automatically
     9  except TypeError as e:
    10      if not str(e).endswith('is required'):
    11          raise e     # Wrong exception arrived to us!
    12  else:
    13      raise RuntimeError('a TypeError should had raised.')
    14  
    15  assert f.softspace == 1