Пример #1
0
    def test_of_max(self):
        self.assertEqual(of_max(RangeReference("[.A1:.B2]")), "MAX([.A1:.B2])")
        self.assertEqual(
            of_max(RangeReference("[.A1:.B2]"), RangeReference("[.C3:.D4]")),
            "MAX([.A1:.B2] ; [.C3:.D4])")

        self.assertRaises(TypeError, of_max, 2)
Пример #2
0
    def test_of_sumproduct(self):
        self.assertEqual(of_sumproduct(RangeReference("[.A1:.B2]")),
                         "SUMPRODUCT([.A1:.B2])")

        self.assertEqual(
            of_sumproduct(RangeReference("[.A1:.B2]"),
                          RangeReference("[.C3:.D4]")),
            "SUMPRODUCT([.A1:.B2] ; [.C3:.D4])")

        self.assertRaises(TypeError, of_sumproduct, 2)
Пример #3
0
    def test_of_average(self):
        self.assertEqual(of_average(RangeReference("[.A1:.B2]")),
                         "AVERAGE([.A1:.B2])")

        self.assertEqual(
            of_average(RangeReference("[.A1:.B2]"),
                       RangeReference("[.C3:.D4]")),
            "AVERAGE([.A1:.B2] ; [.C3:.D4])")

        self.assertRaises(TypeError, of_average, 2)
Пример #4
0
def of_reference(range_address, source=None):
    """Return the syntax for a reference"""
    reference = range_address.str
    if source is not None:
        reference = source + " " + reference
    reference = "[" + reference + "]"
    if type(range_address) is Cell:
        return CellReference(reference)
    elif type(range_address) is Range:
        return RangeReference(reference)
    else:
        raise TypeError, "Not a Cell or Range"
Пример #5
0
 def test_of_sumsq(self):
     self.assertEqual(of_sumsq(RangeReference("[.A1:.B2]")), "SUMSQ([.A1:.B2])")
     self.assertEqual(of_sumsq(RangeReference("[.A1:.B2]"), RangeReference("[.C3:.D4]")), "SUMSQ([.A1:.B2] ; [.C3:.D4])")
     self.assertRaises(TypeError, of_sumsq, 2)
Пример #6
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)
Пример #7
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)
Пример #8
0
 def test_of_multinomial(self):
     self.assertEqual(of_multinomial(RangeReference("[.A1:.B2]")), "MULTINOMIAL([.A1:.B2])")
     self.assertEqual(of_multinomial(RangeReference("[.A1:.B2]"), RangeReference("[.C3:.D4]")), "MULTINOMIAL([.A1:.B2] ; [.C3:.D4])")
     self.assertRaises(TypeError, of_multinomial, 2)
Пример #9
0
 def test_of_lcm_add(self):
     self.assertEqual(of_lcm_add(RangeReference("[.A1:.B2]")), "LCM_ADD([.A1:.B2])")
     self.assertEqual(of_lcm_add(RangeReference("[.A1:.B2]"), RangeReference("[.C3:.D4]")), "LCM_ADD([.A1:.B2] ; [.C3:.D4])")
     self.assertRaises(TypeError, of_lcm_add, 2)
Пример #10
0
 def test_of_countif(self):
     self.assertEqual(of_countif(RangeReference("[.A1:.B2]"), Number("3")), "COUNTIF([.A1:.B2];3)")
     self.assertRaises(TypeError, of_countif, 2)
Пример #11
0
 def test_of_countblank(self):
     self.assertEqual(of_countblank(RangeReference("[.A1:.B2]")), "COUNTBLANK([.A1:.B2])")
     self.assertRaises(TypeError, of_countblank, 2)