def test_can_access_project_id(self): test_project_folder_to_project_id = { "dancing_castle": "10205819", } for project_folder, project_id in test_project_folder_to_project_id.iteritems(): project_path = common_testing.get_test_project_path(project_folder) assert project_id, scratch.Project(project_path).project_id
def test_can_access_project_id(self): test_project_folder_to_project_id = { "dancing_castle": "10205819", } for project_folder, project_id in test_project_folder_to_project_id.iteritems(): project_path = common_testing.get_test_project_path(project_folder) assert project_id, scratch.Project(project_path).project_id
def setUp(self): self.project = scratch.Project(common_testing.get_test_project_path(self.project_folder))
def test_fail_on_project_with_missing_sound_files(self): with self.assertRaises(scratch.ProjectError): # TODO: check error type scratch.Project(common_testing.get_test_project_path("missing_image_resources"))
def test_fail_on_non_existing_input_path(self): with self.assertRaises(EnvironmentError): # TODO: check error message scratch.Project(common_testing.get_test_project_path("non_existing_path"))
def test_fail_on_non_existing_input_path(self): with self.assertRaises(EnvironmentError): # TODO: check error message scratch.Project(common_testing.get_test_project_path("non_existing_path"))
def setUp(self): unittest.TestCase.setUp(self) self.project = scratch.RawProject.from_project_folder_path(common_testing.get_test_project_path("dancing_castle"))
def test_can_create_from_project_directory(self): for project_name in self.TEST_PROJECTS: assert scratch.RawProject.from_project_folder_path(common_testing.get_test_project_path(project_name))
def test_can_access_unused_resources_of_project(self): project = scratch.Project(common_testing.get_test_project_path("simple"), name="simple", project_id=common_testing.PROJECT_DUMMY_ID) assert len(project.unused_resource_paths) > 0 expected_resources = ['0.png', '2.wav', '3.png', '4.png', '5.png', '6.png', '8.png'] assert set(map(os.path.basename, project.unused_resource_paths)) == set(expected_resources)
def test_can_create_from_project_directory(self): for project_name in self.TEST_PROJECTS: assert scratch.RawProject.from_project_folder_path(common_testing.get_test_project_path(project_name))
def test_can_create_from_raw_content(self): for project_name in self.TEST_PROJECTS: project_data_path = os.path.join(common_testing.get_test_project_path(project_name), scratch._PROJECT_FILE_NAME) assert scratch.RawProject.from_project_code_content(common.content_of(project_data_path))
def test_can_access_unused_resources_of_project(self): project = scratch.Project(common_testing.get_test_project_path("simple"), name="simple", id_=common_testing.PROJECT_DUMMY_ID) assert len(project.unused_resource_paths) > 0 expected_resources = ['0.png', '2.wav', '3.png', '4.png', '5.png', '6.png', '8.png'] assert set(map(os.path.basename, project.unused_resource_paths)) == set(expected_resources)
def test_can_access_listened_pressed_keys(self): project = scratch.Project(common_testing.get_test_project_path("keys_pressed")) assert project.listened_keys == set(["d", "c", "a", "4", "8"])
def setUp(self): self.project = scratch.Project(common_testing.get_test_project_path(self.project_folder))
def test_fail_on_project_with_missing_sound_files(self): with self.assertRaises(scratch.ProjectError): # TODO: check error type scratch.Project(common_testing.get_test_project_path("missing_image_resources"))
def test_fail_on_corrupt_file(self): with self.assertRaises((scratch.UnsupportedProjectFileError, scratch.ObjectError)): scratch.RawProject.from_project_folder_path(common_testing.get_test_project_path("faulty_json_file"))
def test_can_access_listened_pressed_keys(self): project = scratch.Project(common_testing.get_test_project_path("keys_pressed")) assert project.listened_keys == set(["d", "c", "a", "4", "8"])
def setUp(self): unittest.TestCase.setUp(self) self.project = scratch.RawProject.from_project_folder_path(common_testing.get_test_project_path("dancing_castle"))
def test_can_create_from_raw_content(self): for project_name in self.TEST_PROJECTS: project_data_path = os.path.join(common_testing.get_test_project_path(project_name), scratch._PROJECT_FILE_NAME) assert scratch.RawProject.from_project_code_content(common.content_of(project_data_path))
def setUp(self): unittest.TestCase.setUp(self) self.project_with_object_indexes = scratch.Project(common_testing.get_test_project_path("dress_up_tera_with_object_indexes")) self.project_without_object_indexes = scratch.Project(common_testing.get_test_project_path("dress_up_tera_without_object_indexes"))
def test_fail_on_corrupt_file(self): with self.assertRaises((scratch.UnsupportedProjectFileError, scratch.ObjectError)): scratch.RawProject.from_project_folder_path(common_testing.get_test_project_path("faulty_json_file"))
def test_can_construct_on_correct_input(self): assert scratch.Project(common_testing.get_test_project_path("simple"), name="dummy", project_id=common_testing.PROJECT_DUMMY_ID)
def setUp(self): unittest.TestCase.setUp(self) self.project_with_object_indexes = scratch.Project(common_testing.get_test_project_path("dress_up_tera_with_object_indexes")) self.project_without_object_indexes = scratch.Project(common_testing.get_test_project_path("dress_up_tera_without_object_indexes"))
def test_can_construct_on_correct_input(self): assert scratch.Project(common_testing.get_test_project_path("simple"), name="dummy", id_=common_testing.PROJECT_DUMMY_ID)