Пример #1
0
    def test070(self):
        # Split by WCS
        self.job.SplitOutput = True
        self.job.OrderOutputBy = "Fixture"
        outlist = PathPost.buildPostList(self.job)

        teststring = "%j.nc"
        self.job.PostProcessorOutputFile = teststring
        PathPreferences.setOutputFileDefaults(
            teststring, "Append Unique ID on conflict"
        )
        subpart, objs = outlist[0]
        filename = PathPost.resolveFileName(self.job, subpart, 0)
        self.assertEqual(filename, "MainJob-0.nc")
        subpart, objs = outlist[1]
        filename = PathPost.resolveFileName(self.job, subpart, 1)
        self.assertEqual(filename, "MainJob-1.nc")

        teststring = "%W-%j.nc"
        self.job.PostProcessorOutputFile = teststring
        PathPreferences.setOutputFileDefaults(
            teststring, "Append Unique ID on conflict"
        )
        subpart, objs = outlist[0]
        filename = PathPost.resolveFileName(self.job, subpart, 0)
        self.assertEqual(filename, "G54-MainJob-0.nc")
        subpart, objs = outlist[1]
        filename = PathPost.resolveFileName(self.job, subpart, 1)
        self.assertEqual(filename, "G55-MainJob-1.nc")
Пример #2
0
    def test080(self):
        # Split by Operation
        self.job.SplitOutput = True
        self.job.OrderOutputBy = "Operation"
        outlist = PathPost.buildPostList(self.job)

        teststring = "%j.nc"
        self.job.PostProcessorOutputFile = teststring
        PathPreferences.setOutputFileDefaults(
            teststring, "Append Unique ID on conflict"
        )
        subpart, objs = outlist[0]
        filename = PathPost.resolveFileName(self.job, subpart, 0)
        self.assertEqual(filename, "MainJob-0.nc")
        subpart, objs = outlist[1]
        filename = PathPost.resolveFileName(self.job, subpart, 1)
        self.assertEqual(filename, "MainJob-1.nc")

        teststring = "%O-%j.nc"
        self.job.PostProcessorOutputFile = teststring
        PathPreferences.setOutputFileDefaults(
            teststring, "Append Unique ID on conflict"
        )
        subpart, objs = outlist[0]
        filename = PathPost.resolveFileName(self.job, subpart, 0)
        self.assertEqual(filename, "OutsideProfile-MainJob-0.nc")
        subpart, objs = outlist[1]
        filename = PathPost.resolveFileName(self.job, subpart, 1)
        self.assertEqual(filename, "DrillAllHoles-MainJob-1.nc")
Пример #3
0
 def test030(self):
     teststring = "%M/outfile.nc"
     self.job.PostProcessorOutputFile = teststring
     outlist = PathPost.buildPostList(self.job)
     subpart, objs = outlist[0]
     filename = PathPost.resolveFileName(self.job, subpart, 0)
     self.assertEqual(filename, f"{self.macro}outfile.nc")
Пример #4
0
 def test050(self):
     # explicitly using the sequence number should include it where indicated.
     teststring = "%S-%d.nc"
     self.job.PostProcessorOutputFile = teststring
     outlist = PathPost.buildPostList(self.job)
     subpart, objs = outlist[0]
     filename = PathPost.resolveFileName(self.job, subpart, 0)
     self.assertEqual(filename, "0-test_filenaming.nc")
Пример #5
0
 def test040(self):
     # unused substitution strings should be ignored
     teststring = "%d%T%t%W%O/testdoc.nc"
     self.job.PostProcessorOutputFile = teststring
     outlist = PathPost.buildPostList(self.job)
     subpart, objs = outlist[0]
     filename = PathPost.resolveFileName(self.job, subpart, 0)
     self.assertEqual(filename, f"{self.testfilename}/testdoc.nc")
Пример #6
0
 def test010(self):
     # Substitute current file path
     teststring = "%D/testfile.nc"
     self.job.PostProcessorOutputFile = teststring
     outlist = PathPost.buildPostList(self.job)
     subpart, objs = outlist[0]
     filename = PathPost.resolveFileName(self.job, subpart, 0)
     self.assertEqual(filename, f"{self.testfilepath}/testfile.nc")
Пример #7
0
 def test030(self):
     teststring = "%M/outfile.nc"
     self.job.PostProcessorOutputFile = teststring
     PathPreferences.setOutputFileDefaults(
         teststring, "Append Unique ID on conflict"
     )
     outlist = PathPost.buildPostList(self.job)
     subpart, objs = outlist[0]
     filename = PathPost.resolveFileName(self.job, subpart, 0)
     self.assertEqual(filename, f"{self.macro}outfile.nc")
Пример #8
0
    def test015(self):
        # Test basic string substitution without splitting
        teststring = "~/Desktop/%j.nc"
        self.job.PostProcessorOutputFile = teststring
        self.job.SplitOutput = False
        outlist = PathPost.buildPostList(self.job)

        self.assertTrue(len(outlist) == 1)
        subpart, objs = outlist[0]

        filename = PathPost.resolveFileName(self.job, subpart, 0)
        self.assertEqual(filename, "~/Desktop/MainJob.nc")
Пример #9
0
    def test000(self):
        # Test basic name generation with empty string
        FreeCAD.setActiveDocument(self.doc.Label)
        teststring = ""
        self.job.PostProcessorOutputFile = teststring
        self.job.SplitOutput = False
        outlist = PathPost.buildPostList(self.job)

        self.assertTrue(len(outlist) == 1)
        subpart, objs = outlist[0]

        filename = PathPost.resolveFileName(self.job, subpart, 0)
        self.assertEqual(filename, f"{self.testfilename}.nc")
Пример #10
0
 def test040(self):
     # unused substitution strings should be ignored
     teststring = "%d%T%t%W%O/testdoc.nc"
     self.job.PostProcessorOutputFile = teststring
     PathPreferences.setOutputFileDefaults(
         teststring, "Append Unique ID on conflict"
     )
     outlist = PathPost.buildPostList(self.job)
     subpart, objs = outlist[0]
     filename = PathPost.resolveFileName(self.job, subpart, 0)
     self.assertEqual(
         os.path.normpath(filename),
         os.path.normpath(f"{self.testfilename}/testdoc.nc"),
     )
Пример #11
0
 def test010(self):
     # Substitute current file path
     teststring = "%D/testfile.nc"
     self.job.PostProcessorOutputFile = teststring
     PathPreferences.setOutputFileDefaults(
         teststring, "Append Unique ID on conflict"
     )
     outlist = PathPost.buildPostList(self.job)
     subpart, objs = outlist[0]
     filename = PathPost.resolveFileName(self.job, subpart, 0)
     self.assertEqual(
         os.path.normpath(filename),
         os.path.normpath(f"{self.testfilepath}/testfile.nc"),
     )
Пример #12
0
    def test015(self):
        # Test basic string substitution without splitting
        teststring = "~/Desktop/%j.nc"
        self.job.PostProcessorOutputFile = teststring
        PathPreferences.setOutputFileDefaults(
            teststring, "Append Unique ID on conflict"
        )
        self.job.SplitOutput = False
        outlist = PathPost.buildPostList(self.job)

        self.assertTrue(len(outlist) == 1)
        subpart, objs = outlist[0]

        filename = PathPost.resolveFileName(self.job, subpart, 0)
        self.assertEqual(
            os.path.normpath(filename), os.path.normpath("~/Desktop/MainJob.nc")
        )
Пример #13
0
    def test060(self):
        # # Split by Tool
        self.job.SplitOutput = True
        self.job.OrderOutputBy = "Tool"
        outlist = PathPost.buildPostList(self.job)

        # substitute jobname and use default sequence numbers
        teststring = "%j.nc"
        self.job.PostProcessorOutputFile = teststring
        PathPreferences.setOutputFileDefaults(
            teststring, "Append Unique ID on conflict"
        )
        subpart, objs = outlist[0]
        filename = PathPost.resolveFileName(self.job, subpart, 0)
        self.assertEqual(filename, "MainJob-0.nc")
        subpart, objs = outlist[1]
        filename = PathPost.resolveFileName(self.job, subpart, 1)
        self.assertEqual(filename, "MainJob-1.nc")

        # Use Toolnumbers and default sequence numbers
        teststring = "%T.nc"
        self.job.PostProcessorOutputFile = teststring
        PathPreferences.setOutputFileDefaults(
            teststring, "Append Unique ID on conflict"
        )
        outlist = PathPost.buildPostList(self.job)
        subpart, objs = outlist[0]
        filename = PathPost.resolveFileName(self.job, subpart, 0)
        self.assertEqual(filename, "5-0.nc")
        subpart, objs = outlist[1]
        filename = PathPost.resolveFileName(self.job, subpart, 1)
        self.assertEqual(filename, "2-1.nc")

        # Use Tooldescriptions and default sequence numbers
        teststring = "%t.nc"
        self.job.PostProcessorOutputFile = teststring
        PathPreferences.setOutputFileDefaults(
            teststring, "Append Unique ID on conflict"
        )
        outlist = PathPost.buildPostList(self.job)
        subpart, objs = outlist[0]
        filename = PathPost.resolveFileName(self.job, subpart, 0)
        self.assertEqual(filename, "TC__7_16__two_flute-0.nc")
        subpart, objs = outlist[1]
        filename = PathPost.resolveFileName(self.job, subpart, 1)
        self.assertEqual(filename, "TC__Drill-1.nc")