示例#1
0
 def test_save_ppttc_bad_file(self, input, output):
     tc = Thinkcell()
     tc.add_template("example.pptx")
     tc.add_chart(
         template_name="example.pptx",
         chart_name="Chart name",
         categories=["alpha", "bravo"],
         data=[["today", 1, 2], ["tomorrow", 3, 4]],
     )
     with pytest.raises(output) as e_info:
         tc.save_ppttc(filename=input)
示例#2
0
 def test_save_ppttc(self):
     tc = Thinkcell()
     tc.add_template("example.pptx")
     tc.add_chart(
         template_name="example.pptx",
         chart_name="Chart name",
         categories=["alpha", "bravo"],
         data=[["today", 1, 2], ["tomorrow", 3, 4]],
     )
     assert tc.save_ppttc(filename="test.ppttc") == True
     os.remove("test.ppttc")
示例#3
0
from thinkcell import Thinkcell

template_name = "simple-template.pptx"
categories = ["Ads", "iPhones", "Other"]
chart_name = "Chart1"
filename = "simple-example.ppttc"

data = [["Apple", 1, 11, 14], ["Google", 8, 2, 15], ["Microsoft", 1, 2, 12]]

tc = Thinkcell()
tc.add_template(template_name)
tc.add_chart(
    template_name=template_name,
    chart_name=chart_name,
    categories=categories,
    data=data,
)

tc.save_ppttc(filename=filename)
示例#4
0
 def test_save_pptc(self):
     tc = Thinkcell()
     with pytest.raises(ValueError) as e_info:
         tc.save_ppttc("test.ppttc")