예제 #1
0
 def test_AggFromNumpy(self):
     x = Coordinate(0)
     a = np.array([1, 2, 3])
     L = AggExpr(1, x, a)
     print(L)
     assert (L[0].sameas(ConstantScalarExpr(1)) and L[1] == x
             and L[2].sameas(ConstantVectorExpr(a)))
예제 #2
0
 def test_AggFromNumber2(self):
     x = Coordinate(0)
     L = AggExpr(1, x)
     assert (L[0].sameas(ConstantScalarExpr(1)) and L[1] == x)
예제 #3
0
 def test_ZeroTimesConstant1(self):
     ex = ConstantScalarExpr(0)*ConstantScalarExpr(2)
     assert(ex == 0)
예제 #4
0
 def test_ConstantTimesZero1(self):
     ex = ConstantScalarExpr(2)*ConstantScalarExpr(0)
     assert(ex == 0)
예제 #5
0
 def test_ConstantTimesOne2(self):
     ex = ConstantScalarExpr(2)*1
     assert(ex == ConstantScalarExpr(2))
예제 #6
0
 def test_ConstantTimesConstant(self):
     ex = ConstantScalarExpr(3)*ConstantScalarExpr(2)
     assert(ex.data()==6)
예제 #7
0
 def test_ConstantMinusZero2(self):
     ex = ConstantScalarExpr(1)-0
     assert(ex == ConstantScalarExpr(1))
예제 #8
0
 def test_ConstantMinusConstant(self):
     ex = ConstantScalarExpr(1)-ConstantScalarExpr(2)
     assert(ex.data()==-1)
예제 #9
0
 def test_ExprTimesZero1(self):
     y = Coordinate(1)
     ex = y * ConstantScalarExpr(0)
     assert(ex == 0)
예제 #10
0
 def test_ZeroMinusExpr2(self):
     y = Coordinate(1)
     ex = ConstantScalarExpr(0) - y
     assert(ex.sameas(-y))
예제 #11
0
 def test_ConstantPlusConstant(self):
     ex = ConstantScalarExpr(1)+ConstantScalarExpr(2)
     assert(ex.data()==3)
예제 #12
0
 def test_ExprMinusZero1(self):
     y = Coordinate(1)
     ex = y - ConstantScalarExpr(0)
     assert(ex == y)
예제 #13
0
 def test_ZeroPlusExpr2(self):
     y = Coordinate(1)
     ex = ConstantScalarExpr(0) + y
     assert(ex == y)
예제 #14
0
 def test_ConstantDivideConstant(self):
     ex = ConstantScalarExpr(3.0)/ConstantScalarExpr(2.0)
     assert(ex.data()==3.0/2.0)
예제 #15
0
 def test_ConstantPlusZero2(self):
     ex = ConstantScalarExpr(1)+0
     assert(ex == ConstantScalarExpr(1))
예제 #16
0
 def test_ZeroTimesExpr2(self):
     y = Coordinate(1)
     ex = ConstantScalarExpr(0) * y
     assert(ex == 0)
예제 #17
0
 def test_ZeroPlusConstant2(self):
     ex = 0+ConstantScalarExpr(1)
     assert(ex == ConstantScalarExpr(1))
예제 #18
0
 def test_OneTimesExpr2(self):
     y = Coordinate(1)
     ex = ConstantScalarExpr(1) * y
     assert(ex == y)
예제 #19
0
 def test_ConstantMinusZero1(self):
     ex = ConstantScalarExpr(1)-ConstantScalarExpr(0)
     assert(ex == ConstantScalarExpr(1))
예제 #20
0
 def test_ConstantPlusZero1(self):
     ex = ConstantScalarExpr(1)+ConstantScalarExpr(0)
     assert(ex ==ConstantScalarExpr(1))
예제 #21
0
 def test_ZeroMinusConstant2(self):
     ex = 0-ConstantScalarExpr(1)
     assert(ex == ConstantScalarExpr(-1))
예제 #22
0
 def test_ExprDividedByOne1(self):
     y = Coordinate(1)
     ex = y/ConstantScalarExpr(1)
     assert(ex == y)
예제 #23
0
 def test_ConstantTimesOne1(self):
     ex = ConstantScalarExpr(2)*ConstantScalarExpr(1)
     assert(ex == ConstantScalarExpr(2))
예제 #24
0
 def test_ExprPowerOne1(self):
     y = Coordinate(1)
     ex = y**ConstantScalarExpr(1)
     assert(ex == y)
예제 #25
0
 def test_OneTimesConstant2(self):
     ex = 1*ConstantScalarExpr(2)
     assert(ex == ConstantScalarExpr(2))
예제 #26
0
 def test_ExprPowerZero1(self):
     y = Coordinate(1)
     ex = y**ConstantScalarExpr(0)
     assert(ex == 1)
예제 #27
0
 def test_ConstantTimesZero2(self):
     ex = ConstantScalarExpr(2)*0
     assert(ex == 0)
예제 #28
0
 def test_ZeroToAPower1(self):
     y = Coordinate(1)
     ex = ConstantScalarExpr(0)**y
     assert(ex == 0)
예제 #29
0
 def test_ZeroTimesConstant2(self):
     ex = 1*ConstantScalarExpr(0)
     assert(ex == 0)
예제 #30
0
 def test_AggFromNumber1(self):
     L = AggExpr(1)
     assert (L[0].sameas(ConstantScalarExpr(1)))