initial commit with barebones project structure

This commit is contained in:
PatchOfScotland
2022-11-29 17:15:14 +01:00
parent f940354be4
commit 9dd2d0c209
11 changed files with 287 additions and 0 deletions

21
tests/testAll.sh Executable file
View File

@ -0,0 +1,21 @@
#! /bin/bash
# Need to more to local dir to run tests
starting_working_dir=$(pwd)
script_name=$(basename "$0")
script_dir=$(dirname "$(realpath "$0")")
cd $script_dir
# Gather all other test files and run pytest
search_dir=.
for entry in "$search_dir"/*
do
if [[ $entry == ./test* ]] && [[ $entry != ./$script_name ]];
then
pytest $entry
fi
done
# Move back to where we called from
cd $starting_working_dir

67
tests/testCore.py Normal file
View File

@ -0,0 +1,67 @@
import unittest
from core.correctness.validation import check_input, valid_string
from core.correctness.vars import VALID_NAME_CHARS
from core.meow import BasePattern, BaseRecipe, BaseRule
class CorrectnessTests(unittest.TestCase):
def setUp(self) -> None:
return super().setUp()
def tearDown(self) -> None:
return super().tearDown()
def testCheckInput(self):
# Valid input
check_input(1, int)
check_input(0, int)
check_input(False, bool)
check_input(True, bool)
# Misstyped input
with self.assertRaises(TypeError):
check_input(1, str)
# Or none
check_input(None, int, or_none=True)
with self.assertRaises(TypeError):
check_input(None, int, or_none=False)
def testValidString(self):
# Valid input
valid_string("", "")
valid_string("David_Marchant", VALID_NAME_CHARS)
# Misstyped input
with self.assertRaises(TypeError):
valid_string(1, VALID_NAME_CHARS)
with self.assertRaises(TypeError):
valid_string("David_Marchant", 1)
# Missing chars
with self.assertRaises(ValueError):
valid_string("David Marchant", VALID_NAME_CHARS)
class MeowTests(unittest.TestCase):
def setUp(self) -> None:
return super().setUp()
def tearDown(self) -> None:
return super().tearDown()
def testBaseRecipe(self):
# Should not be implementable on its own
with self.assertRaises(TypeError):
BaseRecipe("", "")
def testBasePattern(self):
# Should not be implementable on its own
with self.assertRaises(TypeError):
BasePattern("", "")
def testBaseRule(self):
# Should not be implementable on its own
with self.assertRaises(TypeError):
BaseRule("", "")

16
tests/testPatterns.py Normal file
View File

@ -0,0 +1,16 @@
import unittest
from patterns.FileEventPattern import FileEventPattern
class CorrectnessTests(unittest.TestCase):
def setUp(self) -> None:
return super().setUp()
def tearDown(self) -> None:
return super().tearDown()
def testFileEventPattern(self):
pass

16
tests/testRecipes.py Normal file
View File

@ -0,0 +1,16 @@
import unittest
from recipes.JupyterNotebookRecipe import JupyterNotebookRecipe
class CorrectnessTests(unittest.TestCase):
def setUp(self) -> None:
return super().setUp()
def tearDown(self) -> None:
return super().tearDown()
def testJupyterNotebookRecipe(self):
pass