summaryrefslogtreecommitdiff
path: root/tests/test_derivatives.py
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2020-10-05 08:15:18 +0200
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2020-10-05 08:21:08 +0200
commit7e0061b4d99e8a23734bdd6d9a83942eb73c5793 (patch)
tree44e52ed1a96995f73d82482c4eb6fbad85b828b5 /tests/test_derivatives.py
parent3dcb6e8be1c2b6048cfc908cb3a6bd324356c57e (diff)
Start testing lesana derivatives
Diffstat (limited to 'tests/test_derivatives.py')
-rw-r--r--tests/test_derivatives.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/test_derivatives.py b/tests/test_derivatives.py
new file mode 100644
index 0000000..f79123c
--- /dev/null
+++ b/tests/test_derivatives.py
@@ -0,0 +1,40 @@
+import shutil
+import tempfile
+import unittest
+
+import lesana
+from lesana import types
+
+
+class DerivedType(types.LesanaString):
+ """
+ A custom type
+ """
+ name = 'derived'
+
+
+class Derivative(lesana.Collection):
+ """
+ A class serived from lesana.Collection
+ """
+
+
+class testDerivatives(unittest.TestCase):
+ def setUp(self):
+ self.tmpdir = tempfile.mkdtemp()
+ shutil.copytree(
+ 'tests/data/derivative',
+ self.tmpdir,
+ dirs_exist_ok=True
+ )
+ self.collection = Derivative(self.tmpdir)
+
+ def tearDown(self):
+ shutil.rmtree(self.tmpdir)
+
+ def test_load_subclasses(self):
+ self.assertIsInstance(self.collection.fields['unknown'], DerivedType)
+
+
+if __name__ == '__main__':
+ unittest.main()