Skip to content

Commit

Permalink
inplace testcases added + tiny refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
AHReccese committed Aug 4, 2024
1 parent 93007b9 commit 11d773c
Showing 1 changed file with 31 additions and 9 deletions.
40 changes: 31 additions & 9 deletions tests/test_dmeta.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,47 @@
from dmeta.functions import update, update_all, clear, clear_all
import os
from dmeta.functions import update, update_all, clear, clear_all

TESTS_DIR_PATH = os.path.join(os.getcwd(), "tests")

def test_clear():
# check the clearance
def test1():
# clear a single .docx file [not inplace]
clear(os.path.join(TESTS_DIR_PATH, "test_a.docx"))


def test_clear_all():
# check all files clearance
def test2():
# clear a single .docx file [inplace]
clear(os.path.join(TESTS_DIR_PATH, "test_a.docx"), in_place=True)


def test3():
# clear all existing .docx files [not inplace]
os.chdir(TESTS_DIR_PATH)
clear_all()


def test_update():
# test meta-data is updated
def test4():
# clear all existing .docx files [inplace]
os.chdir(TESTS_DIR_PATH)
clear_all(in_place=True)


def test5():
# update a single .docx file [not inplace]
update(os.path.join(TESTS_DIR_PATH, "config.json"), os.path.join(TESTS_DIR_PATH, "test_a.docx"))


def test_update_all():
# test all files meta-data are updated
def test6():
# update a single .docx file [inplace]
update(os.path.join(TESTS_DIR_PATH, "config.json"), os.path.join(TESTS_DIR_PATH, "test_a.docx"), in_place=True)


def test7():
# update all existing .docx files [not inplace]
os.chdir(TESTS_DIR_PATH)
update_all(os.path.join(TESTS_DIR_PATH, "config.json"))


def test8():
# update all existing .docx files [inplace]
os.chdir(TESTS_DIR_PATH)
update_all(os.path.join(TESTS_DIR_PATH, "config.json"), in_place=True)

0 comments on commit 11d773c

Please sign in to comment.