def test_npv():
    'Verifies correctness of the NPV calculation'
    nose.tools.eq_(npv([0], [0]), 1.0)
    nose.tools.eq_(npv([0, 0], [0, 1]), 1.0)
    nose.tools.eq_(npv([0, 1], [0, 0]), 0.5)
    nose.tools.eq_(npv([1, 0, 0, 1], [0, 0, 0, 0]), 0.5)
    nose.tools.eq_(npv([1, 0, 0, 1], [0, 1, 1, 0]), 0.0)
    nose.tools.eq_(npv([0, 1, 1, 0], [0, 0, 1, 0]), (2.0 / 3))
    nose.tools.eq_(npv([1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0]), 1.0)
    nose.tools.eq_(npv([1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 0, 1]), 0.8)
    nose.tools.eq_(npv([1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 0, 1, 0, 1]), 0.6)
    nose.tools.eq_(npv([1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1, 0, 1, 0, 1]), 0.4)
    nose.tools.eq_(npv([1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1, 0, 1, 0, 1]), 0.2)
    nose.tools.eq_(npv([1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]), 0.0)
    nose.tools.assert_raises(AssertionError, (lambda : npv([1, 0, 1], [1, 0])))
    nose.tools.assert_raises(AssertionError, (lambda : npv([1, 0], [1, 0, 1])))
    nose.tools.assert_raises(AssertionError, (lambda : npv([1, 0, 2], [1, 0, 1])))
    nose.tools.assert_raises(AssertionError, (lambda : npv([1, 0, 1], [1, 0, 2])))
Verifies correctness of the NPV calculation
def test_npv():
    
    nose.tools.eq_(npv([0], [0]), 1.0)
    nose.tools.eq_(npv([0, 0], [0, 1]), 1.0)
    nose.tools.eq_(npv([0, 1], [0, 0]), 0.5)
    nose.tools.eq_(npv([1, 0, 0, 1], [0, 0, 0, 0]), 0.5)
    nose.tools.eq_(npv([1, 0, 0, 1], [0, 1, 1, 0]), 0.0)
    nose.tools.eq_(npv([0, 1, 1, 0], [0, 0, 1, 0]), (2.0 / 3))
    nose.tools.eq_(npv([1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0]), 1.0)
    nose.tools.eq_(npv([1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 0, 1]), 0.8)
    nose.tools.eq_(npv([1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 0, 1, 0, 1]), 0.6)
    nose.tools.eq_(npv([1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1, 0, 1, 0, 1]), 0.4)
    nose.tools.eq_(npv([1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1, 0, 1, 0, 1]), 0.2)
    nose.tools.eq_(npv([1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]), 0.0)
    nose.tools.assert_raises(AssertionError, (lambda : npv([1, 0, 1], [1, 0])))
    nose.tools.assert_raises(AssertionError, (lambda : npv([1, 0], [1, 0, 1])))
    nose.tools.assert_raises(AssertionError, (lambda : npv([1, 0, 2], [1, 0, 1])))
    nose.tools.assert_raises(AssertionError, (lambda : npv([1, 0, 1], [1, 0, 2])))