Пример #1
0
def testReturnsIdentityCase():
  f = lambda x: x
  result = fix_args(f)
  assert result(100) == f(100)
Пример #2
0
def testReturnsFunction():
  f = lambda x: x
  assert inspect.isfunction( fix_args(f) )
Пример #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)
Пример #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)
Пример #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)
Пример #6
0
def testOneConstantArg():
  f = lambda x,y: x+y
  result = fix_args(f,y=10)
  assert result(100) == f(100,10)
Пример #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)
Пример #8
0
def testReturnsFunction():
    f = lambda x: x
    assert inspect.isfunction(fix_args(f))
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #13
0
def testOneConstantArg():
    f = lambda x, y: x + y
    result = fix_args(f, y=10)
    assert result(100) == f(100, 10)
Пример #14
0
def testReturnsIdentityCase():
    f = lambda x: x
    result = fix_args(f)
    assert result(100) == f(100)