コード例 #1
0
ファイル: test_compile.py プロジェクト: tactycHQ/Saturn
    def test_string_quotes(self):
        cell = Cell(address="A1", sheet="sheet1")
        cell.value = u"hello \"world'"

        code, ast = cell2code(cell, named_ranges=[])

        assert code == u'u"hello \\"world\'"'

        RangeCore
        assert eval(code) == u"hello \"world'"
コード例 #2
0
ファイル: test_compile.py プロジェクト: tactycHQ/Saturn
    def test_formula(self):
        cell = Cell(address="A1", sheet="sheet1")
        cell.formula = "10+20"

        code, ast = cell2code(cell, named_ranges=[])

        assert code == 'RangeCore.apply("add",10,20,(1, \'A\'))'

        RangeCore
        assert eval(code) == 30
コード例 #3
0
ファイル: test_compile.py プロジェクト: tactycHQ/Saturn
    def test_formula_string_unicode(self):
        cell = Cell(address="A1", sheet="sheet1")
        cell.formula = "=IF(1, \"a☺\", \"b☺\")"

        code, ast = cell2code(cell, named_ranges=[])

        assert code == u'("a☺" if 1 else "b☺")'

        RangeCore
        assert eval(code) == u"a☺"
コード例 #4
0
    def test_string_unicode(self):
        cell = Cell(address="A1", sheet="sheet1")
        cell.value = u"hello world ☺"

        code, ast = cell2code(cell, named_ranges=[])

        assert code == u'"hello world ☺"'

        RangeCore
        assert eval(code) == u"hello world ☺"
コード例 #5
0
ファイル: test_compile.py プロジェクト: anthill/koala
    def test_formula(self):
        cell = Cell(address="A1", sheet="sheet1")
        cell.formula = "10+20"

        code, ast = cell2code(cell, named_ranges=[])

        assert code == 'RangeCore.apply("add",10,20,(1, \'A\'))'

        RangeCore
        assert eval(code) == 30
コード例 #6
0
ファイル: test_compile.py プロジェクト: anthill/koala
    def test_string_quotes(self):
        cell = Cell(address="A1", sheet="sheet1")
        cell.value = u"hello \"world'"

        code, ast = cell2code(cell, named_ranges=[])

        assert code == u'u"hello \\"world\'"'

        RangeCore
        assert eval(code) == u"hello \"world'"
コード例 #7
0
ファイル: test_compile.py プロジェクト: anthill/koala
    def test_formula_string_unicode(self):
        cell = Cell(address="A1", sheet="sheet1")
        cell.formula = "=IF(1, \"a☺\", \"b☺\")"

        code, ast = cell2code(cell, named_ranges=[])

        assert code == u'("a☺" if 1 else "b☺")'

        RangeCore
        assert eval(code) == u"a☺"