import os


def open_file(filename):
    ''' Load a file from the fixtures directory. '''
    path = 'fixtures/' + filename
    if ('tests' in os.listdir('.')):
        path = 'tests/' + path
    return open(path, mode='rb')

import os


def open_file(filename, mode='rb'):
    ''' Load a file from the fixtures directory. '''
    path = 'fixtures/' + filename
    if ('tests' in os.listdir('.')):
        path = 'tests/' + path
    return open(path, mode=mode)

Support opening files as text streams on tests
Support opening files as text streams on tests

  import os
  
  
- def open_file(filename):
+ def open_file(filename, mode='rb'):
      ''' Load a file from the fixtures directory. '''
      path = 'fixtures/' + filename
      if ('tests' in os.listdir('.')):
          path = 'tests/' + path
-     return open(path, mode='rb')
+     return open(path, mode=mode)
  
Support opening files as text streams on tests
## Code Before:
import os


def open_file(filename):
    ''' Load a file from the fixtures directory. '''
    path = 'fixtures/' + filename
    if ('tests' in os.listdir('.')):
        path = 'tests/' + path
    return open(path, mode='rb')

## Instruction:
Support opening files as text streams on tests
## Code After:
import os


def open_file(filename, mode='rb'):
    ''' Load a file from the fixtures directory. '''
    path = 'fixtures/' + filename
    if ('tests' in os.listdir('.')):
        path = 'tests/' + path
    return open(path, mode=mode)
