
import os

os.system('make all')
import example1
def test_f():
    assert example1.f(1) - 1 <= 10 ** -7


def test_myfun():
    assert example1.myfun(example1.f, 2.0) - 4.0 <= 10 ** -7

os.system('make alternate')

import example2


def test2_f():
    assert example2.f(1) - 1 <= 10 ** -7


def test2_myfun():
    assert example2.myfun(example2.f, 2.0) - 4.0 <= 10 ** -7

os.system('make clean')


import os

import pytest

#print("pwd:")
#os.system('pwd')
#import subprocess
#subprocess.check_output('pwd')


os.system('make all')
import example1


def test_f():
    assert example1.f(1) - 1 <= 10 ** -7


def test_myfun():
    """Demonstrate that calling code with wrong object type results
    in TypeError exception."""
    with pytest.raises(TypeError):
        assert example1.myfun(example1.f, 2.0) - 4.0 <= 10 ** -7

os.system('make alternate')

import example2


def test2_f():
    assert example2.f(1) - 1 <= 10 ** -7


def test2_myfun():
    assert example2.myfun(example2.f, 2.0) - 4.0 <= 10 ** -7

os.system('make clean')

Add pytest.raises for test that fails on purpose.
Add pytest.raises for test that fails on purpose.

  
  import os
  
+ import pytest
+ 
+ #print("pwd:")
+ #os.system('pwd')
+ #import subprocess
+ #subprocess.check_output('pwd')
+ 
+ 
  os.system('make all')
  import example1
+ 
+ 
  def test_f():
      assert example1.f(1) - 1 <= 10 ** -7
  
  
  def test_myfun():
+     """Demonstrate that calling code with wrong object type results
+     in TypeError exception."""
+     with pytest.raises(TypeError):
-     assert example1.myfun(example1.f, 2.0) - 4.0 <= 10 ** -7
+         assert example1.myfun(example1.f, 2.0) - 4.0 <= 10 ** -7
  
  os.system('make alternate')
  
  import example2
  
  
  def test2_f():
      assert example2.f(1) - 1 <= 10 ** -7
  
  
  def test2_myfun():
      assert example2.myfun(example2.f, 2.0) - 4.0 <= 10 ** -7
  
  os.system('make clean')
  
Add pytest.raises for test that fails on purpose.
## Code Before:

import os

os.system('make all')
import example1
def test_f():
    assert example1.f(1) - 1 <= 10 ** -7


def test_myfun():
    assert example1.myfun(example1.f, 2.0) - 4.0 <= 10 ** -7

os.system('make alternate')

import example2


def test2_f():
    assert example2.f(1) - 1 <= 10 ** -7


def test2_myfun():
    assert example2.myfun(example2.f, 2.0) - 4.0 <= 10 ** -7

os.system('make clean')

## Instruction:
Add pytest.raises for test that fails on purpose.
## Code After:

import os

import pytest

#print("pwd:")
#os.system('pwd')
#import subprocess
#subprocess.check_output('pwd')


os.system('make all')
import example1


def test_f():
    assert example1.f(1) - 1 <= 10 ** -7


def test_myfun():
    """Demonstrate that calling code with wrong object type results
    in TypeError exception."""
    with pytest.raises(TypeError):
        assert example1.myfun(example1.f, 2.0) - 4.0 <= 10 ** -7

os.system('make alternate')

import example2


def test2_f():
    assert example2.f(1) - 1 <= 10 ** -7


def test2_myfun():
    assert example2.myfun(example2.f, 2.0) - 4.0 <= 10 ** -7

os.system('make clean')
