def test_what(self): self.assertFalse(os.path.isfile(os.path.join(TESTDIR, '2=Hamlet'))) namaste.what(TESTDIR, "Hamlet") self.assertTrue(os.path.isfile(os.path.join(TESTDIR, '2=Hamlet'))) f = open(os.path.join(TESTDIR, '2=Hamlet')) self.assertEqual(f.read(),"Hamlet\n") f.close()
def test_what(self): self.assertFalse(os.path.isfile(os.path.join(TESTDIR, '2=Hamlet'))) namaste.what(TESTDIR, "Hamlet") self.assertTrue(os.path.isfile(os.path.join(TESTDIR, '2=Hamlet'))) f = open(os.path.join(TESTDIR, '2=Hamlet')) self.assertEqual(f.read(), "Hamlet\n") f.close()
def test_get(self): namaste.dirtype(TESTDIR, 'bagit_0.1') namaste.who(TESTDIR, "Twain,M.") namaste.what(TESTDIR, "Hamlet") namaste.when(TESTDIR, "2005") namaste.where(TESTDIR, "Seattle") tags = namaste.get(TESTDIR) tags.sort() self.assertEqual(tags, [ os.path.join(TESTDIR, namaste._make_namaste(0, 'bagit_0.1')), os.path.join(TESTDIR, namaste._make_namaste(1, 'Twain,M.')), os.path.join(TESTDIR, namaste._make_namaste(2, 'Hamlet')), os.path.join(TESTDIR, namaste._make_namaste(3, '2005')), os.path.join(TESTDIR, namaste._make_namaste(4, 'Seattle')), ])