A parser inspired by the django orm.
all tests work
2 files changed, +9 -1
+1-1parsers/manager.py
| @@ -15,7 +15,7 @@ class Manager: | ||
| 15 | 15 | """Create and save object""" |
| 16 | 16 | cls = self.cls |
| 17 | 17 | obj = cls(**kwargs) |
| 18 | - self.append(obj) | |
| 18 | + obj.save() | |
| 19 | 19 | |
| 20 | 20 | def all(self): |
| 21 | 21 | return self.objects |
+8-0tests/test_create.py
| @@ -2,7 +2,15 @@ import parsers | ||
| 2 | 2 | import unittest |
| 3 | 3 | |
| 4 | 4 | |
| 5 | +class Test(parsers.Parser): | |
| 6 | + a = parsers.Field() | |
| 7 | + | |
| 8 | + | |
| 5 | 9 | class TestCreate(unittest.TestCase): |
| 6 | 10 | |
| 11 | + def test_create(self): | |
| 12 | + t = Test('a') | |
| 13 | + self.assertEqual(t.a, 'a') | |
| 14 | + | |
| 7 | 15 | def test_nullable(self): |
| 8 | 16 | pass |