def test_prepares_blocks_using_the_exposure(self): a_job = Job({ EXPOSURE: os.path.join(test.SCHEMA_EXAMPLES_DIR, EXPOSURE_TEST_FILE) }) a_job._partition() blocks_keys = a_job.blocks_keys expected_block = job.Block( (shapes.Site(9.15000, 45.16667), shapes.Site(9.15333, 45.12200), shapes.Site(9.14777, 45.17999))) self.assertEqual(1, len(blocks_keys)) self.assertEqual(expected_block, job.Block.from_kvs(blocks_keys[0]))
def test_with_no_partition_we_just_process_a_single_block(self): job.SITES_PER_BLOCK = 1 # test exposure has 6 assets a_job = Job({ EXPOSURE: os.path.join(test.SCHEMA_EXAMPLES_DIR, EXPOSURE_TEST_FILE) }) self.generated_files.append(a_job.super_config_path) a_job._partition() blocks_keys = a_job.blocks_keys # but we have 1 block instead of 6 self.assertEqual(1, len(blocks_keys))
def test_prepares_blocks_using_the_exposure_and_filtering(self): a_job = Job({ EXPOSURE: os.path.join(test.SCHEMA_EXAMPLES_DIR, EXPOSURE_TEST_FILE), INPUT_REGION: test.do_test_file(REGION_EXPOSURE_TEST_FILE) }) self.generated_files.append(a_job.super_config_path) a_job._partition() blocks_keys = a_job.blocks_keys expected_block = job.Block( (shapes.Site(9.15, 45.16667), shapes.Site(9.15333, 45.122), shapes.Site(9.14777, 45.17999))) self.assertEqual(1, len(blocks_keys)) self.assertEqual(expected_block, job.Block.from_kvs(blocks_keys[0]))
def test_a_job_has_an_identifier(self): self.assertEqual(1, Job({}, 1).id)