Пример #1
0
    def test_drillsim_from_existing_event_file_2019(self):
        event_from_file = adripy.event.DrillEvent.read_from_file(
            TEST_EVENT_FILE_2019_2)
        drill_sim = DrillSim(self.drill_string, event_from_file,
                             self.solver_settings, TEST_WORKING_DIRECTORY,
                             TEST_ANALYSIS_NAME)
        drill_sim.build()

        failures = check_file_contents(
            os.path.join(drill_sim.directory, drill_sim.acf_filename),
            EXPECTED_DRILLSIM_FROM_EXISTING_EVENT_FILE_ACF_TEXT)
        self.assertListEqual(failures, [])
Пример #2
0
 def test_build_evt_contents(self):
     """Tests that the event file created in the DrillSim directory has the correct contents.        
     
     """
     drill_sim = DrillSim(self.drill_string, self.event,
                          self.solver_settings, TEST_WORKING_DIRECTORY,
                          TEST_ANALYSIS_NAME)
     drill_sim.build()
     evt_file = os.path.join(TEST_WORKING_DIRECTORY,
                             TEST_ANALYSIS_NAME + '.evt')
     failures = check_file_contents(evt_file,
                                    EXPECTED_DRILLSIM_EVENT_FILE_TEXT)
     self.assertListEqual(failures, [])
Пример #3
0
 def test_build_adm_contents(self):
     """Tests that the event file created in the DrillSim directory has the correct contents.        
     
     """
     drill_sim = DrillSim(self.drill_string, self.event,
                          self.solver_settings, TEST_WORKING_DIRECTORY,
                          TEST_ANALYSIS_NAME)
     pason_data = dripy.PasonData(TEST_PASON_DATA)
     drill_sim.get_pason_inputs(pason_data, show_plots=False)
     drill_sim.build()
     adm_file = os.path.join(TEST_WORKING_DIRECTORY,
                             TEST_ANALYSIS_NAME + '.adm')
     n_adm_lines = len(open(adm_file, 'r').readlines())
     expected_n_adm_lines = 12538
     self.assertEqual(n_adm_lines, expected_n_adm_lines)
Пример #4
0
    def test_input_deck_directory_contents(self):
        """Tests that the input deck (adm, acf, cmd files) are written to the directory
        """
        drill_sim = DrillSim(self.drill_string, self.event,
                             self.solver_settings, TEST_WORKING_DIRECTORY,
                             TEST_ANALYSIS_NAME)

        drill_sim.build()
        expected_contents = [
            drill_sim.event.filename,
            os.path.join(drill_sim.directory, drill_sim.string_filename),
            drill_sim.solver_settings.filename,
            os.path.join(drill_sim.directory, drill_sim.adm_filename),
            os.path.join(drill_sim.directory, drill_sim.acf_filename),
            os.path.join(drill_sim.directory, drill_sim.cmd_filename),
            os.path.join(drill_sim.directory, 'aview.cmd'),
            os.path.join(drill_sim.directory, 'aview.log'),
            os.path.join(drill_sim.directory, 'build.cmd'),
        ]

        for tool in drill_sim.string.tools:
            tool_file = tool['Property_File']
            expected_contents.append(
                os.path.join(drill_sim.directory, tool_file))
        expected_contents.append(
            os.path.join(drill_sim.directory,
                         drill_sim.string.top_drive['Property_File']))
        expected_contents.append(
            os.path.join(drill_sim.directory,
                         drill_sim.string.parameters['Hole_Property_File']))

        actual_contents = glob.glob(os.path.join(drill_sim.directory, '*'))

        # Remove the aview.cmd.bak file from the actual contents list
        if os.path.join(drill_sim.directory,
                        'aview.cmd.bak') in actual_contents:
            actual_contents.remove(
                os.path.join(drill_sim.directory, 'aview.cmd.bak'))

        # Remove the aview.loq file from the actual contents list
        if os.path.join(drill_sim.directory, 'aview.loq') in actual_contents:
            actual_contents.remove(
                os.path.join(drill_sim.directory, 'aview.loq'))

        self.assertListEqual(sorted(actual_contents),
                             sorted(expected_contents))