summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBrian Waldon <bcwaldon@gmail.com>2012-06-01 15:00:38 -0700
committerBrian Waldon <bcwaldon@gmail.com>2012-06-01 15:00:38 -0700
commit96ef8b7a5faa6b8c744e658f33923cb571f50564 (patch)
treec4793b928e95febe24e5f279feef5a1ef47b8aa7 /test
parent4160dc4e65dc4c5c8ba2f2245512586490072f60 (diff)
downloadwarlock-96ef8b7a5faa6b8c744e658f33923cb571f50564.tar.gz
Add basic test and implement minimal logic
Diffstat (limited to 'test')
-rw-r--r--test/test_core.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/test_core.py b/test/test_core.py
new file mode 100644
index 0000000..a59778c
--- /dev/null
+++ b/test/test_core.py
@@ -0,0 +1,23 @@
+import unittest
+
+import warlock
+
+
+class TestCore(unittest.TestCase):
+ def test_core(self):
+ schema = {
+ 'name': 'Country',
+ 'properties': {
+ 'name': {'type': 'string'},
+ 'abbreviation': {'type': 'string'},
+ },
+ }
+
+ Country = warlock.Class(schema)
+
+ sweden = Country(name='Sweden', abbreviation='SE')
+
+ self.assertEqual(sweden.name, 'Sweden')
+ self.assertEqual(sweden.abbreviation, 'SE')
+ self.assertRaises(AttributeError, getattr, sweden, 'overlord')
+ self.assertRaises(AttributeError, setattr, sweden, 'overlord', 'Bears')