import os
import unittest
from m_librarian.db import open_db, init_db
+from m_librarian.inp import import_inpx
class TestCase(unittest.TestCase):
except OSError:
pass
+ def import_inpx(self, inpx):
+ import_inpx(os.path.join(os.path.dirname(__file__), inpx))
+
def main():
try:
import os
from tests import TestCase, main
from m_librarian.db import Author, Book
-from m_librarian.inp import import_inpx
class TestInp(TestCase):
def test_import_bad_inpx(self):
- self.assertRaises(
- ValueError, import_inpx,
- os.path.join(os.path.dirname(__file__), 'bad.inpx'))
+ self.assertRaises(ValueError, self.import_inpx, 'bad.inpx')
def test_import_inpx(self):
- import_inpx(os.path.join(os.path.dirname(__file__), 'test.inpx'))
+ self.import_inpx('test.inpx')
self.assertEqual(Author.select().count(), 4)
self.assertEqual(Book.select().count(), 4)