Example #1
0
    def test_write_path(self):
        include_name = r'C:\NASA\formats\pynastran_v0.6\pyNastran\bdf\writePath.py'
        msg1 = write_include(include_name, is_windows=True)
        sline1 = _split_path(include_name, is_windows=True)

        include_name = r'/opt/NASA/formats/pynastran_v0.6/pyNastran/bdf/writePath.py'
        msg2 = write_include(include_name, is_windows=False)
        sline2 = _split_path(include_name, is_windows=False)

        include_name = r'/opt/NASA/test1/test2/test3/test4/formats/pynastran_v0.6/pyNastran/bdf/writePath.py'
        msg3 = write_include(include_name, is_windows=False)
        sline3 = _split_path(include_name, is_windows=False)

        include_name = r'opt/NASA/test1/test2/test3/test4/formats/pynastran_v0.6/pyNastran/bdf/writePath.py'
        msg4 = write_include(include_name, is_windows=True)
        sline4 = _split_path(include_name, is_windows=True)

        msg1_expected = r"INCLUDE 'C:\\NASA\formats\pynastran_v0.6\pyNastran\bdf\writePath.py'" + '\n'
        msg2_expected = "INCLUDE '/opt/NASA/formats/pynastran_v0.6/pyNastran/bdf/writePath.py'\n"
        msg3_expected = (
            "INCLUDE '/opt/NASA/test1/test2/test3/test4/formats/pynastran_v0.6/\n"
            "        pyNastran/bdf/writePath.py'\n")
        msg4_expected = (
            r"INCLUDE 'opt\NASA\test1\test2\test3\test4\formats\pynastran_v0.6"
            + '\\\n' + r"        pyNastran\bdf\writePath.py'" + '\n')
        assert msg1 == msg1_expected, 'test1 actual:\n%r\nexpected:\n%r\n%s' % (
            msg1, msg1_expected, str(sline1))
        assert msg2 == msg2_expected, 'test2 actual:\n%r\nexpected:\n%r\n%s' % (
            msg2, msg2_expected, str(sline2))
        assert msg3 == msg3_expected, 'test3 actual:\n%r\nexpected:\n%r\n%s' % (
            msg3, msg3_expected, str(sline3))
        assert msg4 == msg4_expected, 'test4 actual:\n%s\nexpected:\n%s\n%s' % (
            msg4, msg4_expected, str(sline4))
Example #2
0
    def test_write_path(self):
        if is_windows:
            include_name = r'C:\NASA\formats\pynastran_v0.6\pyNastran\bdf\writePath.py'
            msg1 = write_include(include_name, is_windows=True)
            sline1 = _split_path(include_name)

            include_name = r'/opt/NASA/formats/pynastran_v0.6/pyNastran/bdf/writePath.py'
            msg2 = write_include(include_name, is_windows=False)
            sline2 = _split_path(include_name)

            include_name = r'/opt/NASA/test1/test2/test3/test4/formats/pynastran_v0.6/pyNastran/bdf/writePath.py'
            msg3 = write_include(include_name, is_windows=False)
            sline3 = _split_path(include_name)

            include_name = r'opt/NASA/test1/test2/test3/test4/formats/pynastran_v0.6/pyNastran/bdf/writePath.py'
            msg4 = write_include(include_name, is_windows=True)
            sline4 = _split_path(include_name)

            msg1_expected = r'INCLUDE C:\\NASA\formats\pynastran_v0.6\pyNastran\bdf\writePath.py' '\n'
            msg2_expected =  'INCLUDE /opt/NASA/formats/pynastran_v0.6/pyNastran/bdf/writePath.py\n'
            msg3_expected = ('INCLUDE /opt/NASA/test1/test2/test3/test4/formats/pynastran_v0.6/\n'
                             '        pyNastran/bdf/writePath.py\n')
            msg4_expected = (r'INCLUDE opt\NASA\test1\test2\test3\test4\formats\pynastran_v0.6' '\\\n'
                             r'        pyNastran\bdf\writePath.py' '\n')
            assert msg1 == msg1_expected, 'test1 actual:\n%r\nexpected:\n%r\n%s' % (msg1, msg1_expected, str(sline1))
            assert msg2 == msg2_expected, 'test2 actual:\n%r\nexpected:\n%r\n%s' % (msg2, msg2_expected, str(sline2))
            assert msg3 == msg3_expected, 'test3 actual:\n%r\nexpected:\n%r\n%s' % (msg3, msg3_expected, str(sline3))
            assert msg4 == msg4_expected, 'test4 actual:\n%r\nexpected:\n%r\n%s' % (msg4, msg4_expected, str(sline4))