Esempio n. 1
0
def testReturnsIdentityCase():
  f = lambda x: x
  result = fix_args(f)
  assert result(100) == f(100)
Esempio n. 2
0
def testReturnsFunction():
  f = lambda x: x
  assert inspect.isfunction( fix_args(f) )
Esempio n. 3
0
def MMSfitfunc(X):
  to_fix = {'Lp': 30, 'Lc': 1100, 'F0': 0, 'K': 1200}
  fixed = fix_args(MMS, **to_fix)
  assert fixed(X) == MMS(X, **to_fix)
Esempio n. 4
0
def testTwoConstantArgsSkipFirst():
  f = lambda x,y,z: (x,y,z)
  result = fix_args(f,x=50,z=50)
  assert result(100) == f(50,100,50)
Esempio n. 5
0
def testTwoConstantArgsWithKeywords():
  def f(x, p1, p2=10):
    return x, p1, p2
  result = fix_args(f, p1=20, p2=30)
  assert result(66) == f(66, 20, 30)
Esempio n. 6
0
def testOneConstantArg():
  f = lambda x,y: x+y
  result = fix_args(f,y=10)
  assert result(100) == f(100,10)
Esempio n. 7
0
def testTwoConstantArgs():
  f = lambda x,y,z: (x,y,z)
  result = fix_args(f,y=50,z=50)
  assert result(100) == f(100,50,50)
Esempio n. 8
0
def testReturnsFunction():
    f = lambda x: x
    assert inspect.isfunction(fix_args(f))
Esempio n. 9
0
def MMSfitfunc(X):
    to_fix = {'Lp': 30, 'Lc': 1100, 'F0': 0, 'K': 1200}
    fixed = fix_args(MMS, **to_fix)
    assert fixed(X) == MMS(X, **to_fix)
Esempio n. 10
0
def testTwoConstantArgsWithKeywords():
    def f(x, p1, p2=10):
        return x, p1, p2

    result = fix_args(f, p1=20, p2=30)
    assert result(66) == f(66, 20, 30)
Esempio n. 11
0
def testTwoConstantArgsSkipFirst():
    f = lambda x, y, z: (x, y, z)
    result = fix_args(f, x=50, z=50)
    assert result(100) == f(50, 100, 50)
Esempio n. 12
0
def testTwoConstantArgs():
    f = lambda x, y, z: (x, y, z)
    result = fix_args(f, y=50, z=50)
    assert result(100) == f(100, 50, 50)
Esempio n. 13
0
def testOneConstantArg():
    f = lambda x, y: x + y
    result = fix_args(f, y=10)
    assert result(100) == f(100, 10)
Esempio n. 14
0
def testReturnsIdentityCase():
    f = lambda x: x
    result = fix_args(f)
    assert result(100) == f(100)