def generate(filename, gridSize):
    prs = Presentation(filename)
    grab_text.gridSize = gridSize
    grids = grab_text.extract_grid(prs)
    grids = grab_text.extract_and_label_images(prs, grids, "", False)
    internal = grab_text.create_json_object(grids)
    internal = json.dumps(internal)
    grab_text.write_to_JSON(grids, filename + ".json")
def compare_json_files(pres_loc, target_loc, gridSize, bordercolor=False):
    grab_text.gridSize = gridSize
    grab_text.bordercolor = bordercolor
    grids = grab_text.Pageset(pres_loc, "", False).grids
    internal = grab_text.create_json_object(grids)
    internal = json.dumps(internal)
    grab_text.write_to_JSON(grids, "temp.json")
    local = 0
    with open('temp.json', 'r') as f:
        local = json.load(f)
    with open(target_loc, 'r') as f:
        real = json.load(f)
        assert real == local
Exemplo n.º 3
0
def compare_json_files(pres_loc, target_loc, gridSize):
        prs = Presentation(pres_loc)
        grab_text.gridSize = gridSize
        grids = grab_text.extract_grid(prs)
        grids = grab_text.extract_and_label_images(prs, grids, "", False)
        internal = grab_text.create_json_object(grids)
        internal = json.dumps(internal)
        grab_text.write_to_JSON(grids, "temp.json")
        local = 0
        with open('/Users/josephreddington/Dropbox/git/azulejoe/temp.json', 'r') as f:
                local = json.load(f)
        with open(target_loc, 'r') as f:
                real = json.load(f)
                assert real == local
Exemplo n.º 4
0
import grab_text
from pptx import Presentation
import json


def test_answer():
    assert grab_text.remove_punctuation("Joe's") == "Joes"


prs = Presentation(
    "/Users/josephreddington/Dropbox/git/CommuniKate/ck20/CK20V2.pptx")
grab_text.gridSize = 5
grids = grab_text.extract_grid(prs)
grids = grab_text.extract_and_label_images(prs, grids, "", False)
grab_text.write_to_JSON(grids, "CK20+V2.json")