Added context manager to close resource after reading.
Changed deprected assertEquals to assertEqual