1 """ this module tests the util.py module """
9 NUMBERS = { 12345:'12,345', 12345.23:'12,345.23', 1234:'1,234'}
11 class TestUtil(unittest.TestCase):
13 for number in NUMBERS.keys():
14 self.assertEqual(util.comma(number), NUMBERS[number])
16 def test_clean_dir(self):
19 self.assertEqual(len(os.listdir(self.basedir)), 3)
20 util.clean_dir(self.basedir)
21 self.assertTrue(os.path.exists(self.basedir))
22 self.assertEqual(len(os.listdir(self.basedir)), 0)
24 if os.path.exists(self.basedir):
25 shutil.rmtree(self.basedir)
27 def _setup_files(self):
28 self.basedir = os.path.join(tempfile.gettempdir(), "mevemontest")
29 os.mkdir(self.basedir)
30 os.mkdir(os.path.join(self.basedir, "testdir"))
31 os.system("touch %s" % os.path.join(self.basedir, "testfile1"))
32 os.system("touch %s" % os.path.join(self.basedir, "testfile2"))