コード例 #1
0
ファイル: test_k20.py プロジェクト: plusxp/kx-1
 def test_ksk(self):
     k = _ksk("1+2")
     p = _Ki(k)
     self.failIf(p != 3, 'got %s, expected 3' % p)
     k = _ksk("{x+y}", _gk(self.f, self.i))
     p = _Kf(k)
     self.failIf(p != 10.0, 'got %s, expected 10.0' % p)
     self.failUnlessRaises(kerr, _ksk, ')')
コード例 #2
0
ファイル: test_k20.py プロジェクト: kevinarpe/kx
 def test_ksk(self):
     k = _ksk("1+2")
     p = _Ki(k)
     self.failIf(p != 3, 'got %s, expected 3' % p)
     k = _ksk("{x+y}", _gk(self.f, self.i))
     p = _Kf(k)
     self.failIf(p != 10.0, 'got %s, expected 10.0' % p)
     self.failUnlessRaises(kerr, _ksk, ')')
コード例 #3
0
ファイル: test_k20.py プロジェクト: kevinarpe/kx
 def testValue(self):
     "Test that pyk object got the value with which it was created"
     i=_Ki(self.i)
     f=_Kf(self.f)
     c=_Kc(self.c)
     s=_Ks(self.s)
     self.failIf(i != 5, 'assigned a value 5 but came out as %s' % i)
     self.failIf(f != 5.0, 'assigned a value 5.0 but came out as %s' % f)
     self.failIf(c != 'c', 'assigned a value \'c\' but came out as %s' % c)
     self.failIf(s != "abc", 'assigned a value "abc" but came out as %s' % s)
コード例 #4
0
ファイル: test_k20.py プロジェクト: plusxp/kx-1
 def testValue(self):
     "Test that pyk object got the value with which it was created"
     i = _Ki(self.i)
     f = _Kf(self.f)
     c = _Kc(self.c)
     s = _Ks(self.s)
     self.failIf(i != 5, 'assigned a value 5 but came out as %s' % i)
     self.failIf(f != 5.0, 'assigned a value 5.0 but came out as %s' % f)
     self.failIf(c != 'c', 'assigned a value \'c\' but came out as %s' % c)
     self.failIf(s != "abc",
                 'assigned a value "abc" but came out as %s' % s)
コード例 #5
0
ファイル: test_k20.py プロジェクト: kevinarpe/kx
 def testReassign(self):
     "Test that we can change the value of a pyk object"
     ki = _sKi(self.i, 10)
     i = _Ki(ki)
     kf = _sKf(self.f, 10.0)
     f = _Kf(kf)
     kc = _sKc(self.c, 'd')
     c = _Kc(kc)
     ks = _sKs(self.s, 'xyz')
     s = _Ks(ks)
     self.failIf(i != 10, 'reassigned a value 10 but came out as %s' % i)
     self.failIf(f != 10.0, 'reassigned a value 10.0 but came out as %s' % f)
     self.failIf(c != 'd', 'reassigned a value \'d\' but came out as %s' % c)
     self.failIf(s != "xyz", 'reassigned a value "xyz" but came out as %s' % s)
コード例 #6
0
ファイル: test_k20.py プロジェクト: plusxp/kx-1
 def testReassign(self):
     "Test that we can change the value of a pyk object"
     ki = _sKi(self.i, 10)
     i = _Ki(ki)
     kf = _sKf(self.f, 10.0)
     f = _Kf(kf)
     kc = _sKc(self.c, 'd')
     c = _Kc(kc)
     ks = _sKs(self.s, 'xyz')
     s = _Ks(ks)
     self.failIf(i != 10, 'reassigned a value 10 but came out as %s' % i)
     self.failIf(f != 10.0,
                 'reassigned a value 10.0 but came out as %s' % f)
     self.failIf(c != 'd',
                 'reassigned a value \'d\' but came out as %s' % c)
     self.failIf(s != "xyz",
                 'reassigned a value "xyz" but came out as %s' % s)
コード例 #7
0
ファイル: K.py プロジェクト: plusxp/kx-1
 def __float__(self):
     return _Kf(self)
コード例 #8
0
ファイル: K.py プロジェクト: kevinarpe/kx
 def __float__(self):
     return _Kf(self)