Exemple #1
0
 def test_of_log(self):
     self.assertEqual(of_log(CellReference("[.B2]"),Number("3")), "LOG([.B2] ; 3)")
     self.assertRaises(TypeError, of_log, 2)
 def test_of_different(self):
     self.assertEqual(of_different("abc").str, "abc")
     self.assertEqual(
         of_different("abc", "def", "ghi").str, "abc<>def<>ghi")
     self.assertEqual(of_different(Number("2"), Number("3")).str, "2<>3")
     self.assertRaises(TypeError, of_different, 2)
 def test_of_upper_equal(self):
     self.assertEqual(of_upper_equal("abc").str, "abc")
     self.assertEqual(
         of_upper_equal("abc", "def", "ghi").str, "abc>=def>=ghi")
     self.assertEqual(of_upper_equal(Number("2"), Number("3")).str, "2>=3")
     self.assertRaises(TypeError, of_different, 2)
 def test_of_add(self):
     self.assertEqual(of_add(CellReference("[.A1]")), "[.A1]")
     self.assertEqual(of_add(Number("2"), CellReference("[.D4]")),
                      "2+[.D4]")
     self.assertRaises(TypeError, of_add, 2)
    def test_of_multiply(self):
        self.assertEqual(of_multiply(CellReference("[.A1]")), "[.A1]")
        self.assertEqual(of_multiply(Number("2"), CellReference("[.D4]")),
                         "2*[.D4]")

        self.assertRaises(TypeError, of_multiply, 2)
Exemple #6
0
 def test_of_ceiling(self):
     self.assertEqual(of_ceiling(Number(2), Number(4)), "CEILING(2 ; 4)")
     self.assertEqual(of_ceiling(Number(1), Number(2), Number(3)), "CEILING(1 ; 2 ; 3)")
     self.assertRaises(TypeError, of_ceiling, 2, 3)
Exemple #7
0
 def test_of_coth(self):
     self.assertEqual(of_coth(Number("2")), "COTH(2)")
     self.assertEqual(of_coth(CellReference("[.A1]")), "COTH([.A1])")
     self.assertRaises(TypeError, of_coth, 2)
Exemple #8
0
 def test_of_quotient(self):
     self.assertEqual(of_quotient(CellReference("[.B2]"),Number("3")), "QUOTIENT([.B2] ; 3)")
     self.assertRaises(TypeError, of_quotient, 2, 3)
Exemple #9
0
 def test_of_radians(self):
     self.assertEqual(of_radians(Number("2")), "RADIANS(2)")
     self.assertEqual(of_radians(CellReference("[.A1]")), "RADIANS([.A1])")
     self.assertRaises(TypeError, of_radians, 2)
Exemple #10
0
 def test_of_odd(self):
     self.assertEqual(of_odd(Number("2")), "ODD(2)")
     self.assertEqual(of_odd(CellReference("[.A1]")), "ODD([.A1])")
     self.assertRaises(TypeError, of_odd, 2)
Exemple #11
0
 def test_of_power(self):
     self.assertEqual(of_power(CellReference("[.B2]"),Number("3")), "POWER([.B2] ; 3)")
     self.assertRaises(TypeError, of_power, 2, 3)
Exemple #12
0
 def test_of_abs(self):
     self.assertEqual(of_abs(Number("2")), "ABS(2)")
     self.assertEqual(of_abs(CellReference("[.A1]")), "ABS([.A1])")
     self.assertRaises(TypeError, of_abs, 2)
Exemple #13
0
 def test_of_mround(self):
     self.assertEqual(of_mround(CellReference("[.B2]"),Number("3")), "MROUND([.B2] ; 3)")
     self.assertRaises(TypeError, of_mround, 2, 3)
Exemple #14
0
 def test_of_log10(self):
     self.assertEqual(of_log10(Number("2")), "LOG10(2)")
     self.assertEqual(of_log10(CellReference("[.A1]")), "LOG10([.A1])")
     self.assertRaises(TypeError, of_log10, 2)
Exemple #15
0
 def test_of_atan(self):
     self.assertEqual(of_atan(Number("2")), "ATAN(2)")
     self.assertEqual(of_atan(CellReference("[.A1]")), "ATAN([.A1])")
     self.assertRaises(TypeError, of_atan, 2)  
Exemple #16
0
 def test_of_randbetween(self):
     self.assertEqual(of_randbetween(CellReference("[.B2]"),Number("3")), "RANDBETWEEN([.B2] ; 3)")
     self.assertRaises(TypeError, of_randbetween, 2, 3)
Exemple #17
0
 def test_of_atan2(self):
     self.assertEqual(of_atan2(Number("1"), CellReference("[.A1]")), "ATAN2(1 ; [.A1])")
     self.assertRaises(TypeError, of_atan2, 2, 2)
Exemple #18
0
 def test_of_roundup(self):
     self.assertEqual(of_roundup(Number("1")), "ROUNDUP(1)")
     self.assertEqual(of_roundup(Number("1"), CellReference("[.A1]")), "ROUNDUP(1 ; [.A1])")
     self.assertRaises(TypeError, of_roundup, 2)
Exemple #19
0
 def test_of_combina(self):
     self.assertEqual(of_combina(Number("1"), CellReference("[.A1]")), "COMBINA(1 ; [.A1])")
     self.assertRaises(TypeError, of_combina, 2, 3)
Exemple #20
0
 def test_of_seriessum(self):
     self.assertEqual(of_seriessum(Number("1"),CellReference("[.A1]"), Number("3"), RangeReference("[.A1:.B2]") ), "SERIESSUM(1 ; [.A1] ; 3 ; [.A1:.B2])")
     self.assertRaises(TypeError, of_seriessum, 2, 3, 4, 5)
    def test_of_if(self):
	self.assertEqual(of_if(LogicalExpression("1>2"), Number("3"),
                                                    Number("4")), "IF(1>2;3;4)")

        self.assertRaises(TypeError, of_if, "1>2", 1, 2)
Exemple #22
0
 def test_of_sqrtpi(self):
     self.assertEqual(of_sqrtpi(Number("2")), "SQRTPI(2)")
     self.assertEqual(of_sqrtpi(CellReference("[.A1]")), "SQRTPI([.A1])")
     self.assertRaises(TypeError, of_sqrtpi, 2)
    def test_of_substract(self):
        self.assertEqual(of_substract(CellReference("[.A1]")), "[.A1]")
        self.assertEqual(of_substract(Number("2"), CellReference("[.D4]")),
                         "2-[.D4]")

        self.assertRaises(TypeError, of_substract, 2)
Exemple #24
0
 def test_of_sumif(self):
     self.assertEqual(of_sumif(RangeReference("[.A1:.B2]"), Number("3")), "SUMIF([.A1:.B2];3)")
     self.assertEqual(of_sumif(RangeReference("[.A1:.B2]"),Number("3") ,RangeReference("[.C3:.D4]")), "SUMIF([.A1:.B2];3;[.C3:.D4])")
     self.assertRaises(TypeError, of_sumif, 2, 3)
    def test_of_divide(self):
        self.assertEqual(of_divide(CellReference("[.A1]")), "[.A1]")
        self.assertEqual(of_divide(Number("2"), CellReference("[.D4]")),
                         "2/[.D4]")

        self.assertRaises(TypeError, of_divide, 2)
Exemple #26
0
 def test_of_trunc(self):
     self.assertEqual(of_trunc(CellReference("[.B2]"),Number("3")), "TRUNC([.B2] ; 3)")
     self.assertRaises(TypeError, of_trunc, 2, 3)
 def test_of_lower(self):
     self.assertEqual(of_lower("abc").str, "abc")
     self.assertEqual(of_lower("abc", "def", "ghi").str, "abc<def<ghi")
     self.assertEqual(of_lower(Number("2"), Number("3")).str, "2<3")
     self.assertRaises(TypeError, of_lower, 2)
Exemple #28
0
 def test_of_acot(self):
     self.assertEqual(of_acot(Number("2")), "ACOT(2)")
     self.assertEqual(of_acot(CellReference("[.A1]")), "ACOT([.A1])")
     self.assertRaises(TypeError, of_acot, 2) 
 def test_of_lower_equal(self):
     self.assertEqual(of_lower_equal("abc").str, "abc")
     self.assertEqual(
         of_lower_equal("abc", "def", "ghi").str, "abc<=def<=ghi")
     self.assertEqual(of_lower_equal(Number("2"), Number("3")).str, "2<=3")
     self.assertRaises(TypeError, of_lower_equal, 2)
Exemple #30
0
 def test_of_iseven(self):
     self.assertEqual(of_iseven(Number("2")), "ISEVEN(2)")
     self.assertEqual(of_iseven(CellReference("[.A1]")), "ISEVEN([.A1])")
     self.assertRaises(TypeError, of_iseven, 2)