def test_save(self): data = FaceDataset() data.read_dataset('tests/fixtures/faces/newdata') data.save('tests/fixtures/faces/newdata/newdata.pkl') self.assertTrue( os.path.exists('tests/fixtures/faces/newdata/newdata.pkl'))
def test_load(self): data = FaceDataset() data.read_dataset('tests/fixtures/faces/newdata') data.save('tests/fixtures/faces/newdata/newdata.pkl') new_data = FaceDataset.load('tests/fixtures/faces/newdata/newdata.pkl') self.assertEqual(data.classes_length, new_data.classes_length) for cls in data.get_classes(): self.assertTrue(cls in new_data.get_classes()) self.assertEqual(data[cls].length, new_data[cls].length)
def setUp(self): data1 = FaceDataset() data1.read_dataset('tests/fixtures/faces/same_faces') data2 = FaceDataset() data2.read_dataset('tests/fixtures/faces/newdata') data1.append(data2) data1.save(os.path.join('tests/fixtures/faces/testset.pkl'))