當前位置: 首頁>>代碼示例>>Python>>正文


Python inputoutput.InputFileLoaderCheckerSaver類代碼示例

本文整理匯總了Python中geotecha.inputoutput.inputoutput.InputFileLoaderCheckerSaver的典型用法代碼示例。如果您正苦於以下問題:Python InputFileLoaderCheckerSaver類的具體用法?Python InputFileLoaderCheckerSaver怎麽用?Python InputFileLoaderCheckerSaver使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了InputFileLoaderCheckerSaver類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_save_data_input_text

 def test_save_data_input_text(self):
     a = InputFileLoaderCheckerSaver()
     a._input_text= "hello"
     a.save_data_to_file=True
     a._save_data()
     assert_equal(self.tempdir.read(
             ('out0002','out0002_input_original.py'), 'utf-8').strip().splitlines(),
                  'hello'.splitlines())
開發者ID:rtrwalker,項目名稱:geotecha,代碼行數:8,代碼來源:test_inputoutput.py

示例2: test_check_zero_or_all

    def test_check_zero_or_all(self):
        a = InputFileLoaderCheckerSaver()
        a.a=4
        a.b=6
        a.c=None
        a._zero_or_all = ['a b c'.split()]

        assert_raises(ValueError, a.check_input_attributes)
開發者ID:rtrwalker,項目名稱:geotecha,代碼行數:8,代碼來源:test_inputoutput.py

示例3: test_save_data_grid_data_dicts

    def test_save_data_grid_data_dicts(self):
        a = InputFileLoaderCheckerSaver()
        a._grid_data_dicts= {'data': np.arange(6).reshape(3,2)}
        a.save_data_to_file=True
        a._save_data()

#        print(os.listdir(os.path.join(self.tempdir.path,'out0002')))
        ok_(os.path.isfile(os.path.join(
            self.tempdir.path, 'out0002','out0002.csv')))
開發者ID:rtrwalker,項目名稱:geotecha,代碼行數:9,代碼來源:test_inputoutput.py

示例4: test_attribute_defaults

    def test_attribute_defaults(self):
        a = InputFileLoaderCheckerSaver()
        a._input_text = 'b=6'
        a._attributes = "a b".split()
        a._attribute_defaults = {'a': 24}
        a._initialize_attributes()
        a._transfer_attributes_from_inputfile()

        assert_equal(a.a, 24)
        assert_equal(a.b, 6)
        assert_equal(a._input_text, 'b=6')
開發者ID:rtrwalker,項目名稱:geotecha,代碼行數:11,代碼來源:test_inputoutput.py

示例5: test_check_attributes_to_force_same_len

    def test_check_attributes_to_force_same_len(self):
        a = InputFileLoaderCheckerSaver()
        a.a = [4,5]
        a.c=None
        a._attributes_to_force_same_len = ['a c'.split()]
        a.check_input_attributes()

        assert_equal(a.c, [None, None])
開發者ID:rtrwalker,項目名稱:geotecha,代碼行數:8,代碼來源:test_inputoutput.py

示例6: test_save_data_input_ext

    def test_save_data_input_ext(self):
        a = InputFileLoaderCheckerSaver()
        a._input_text= "hello"
        a.input_ext= '.txt'
        a.save_data_to_file=True
        a._save_data()

        ok_(os.path.isfile(os.path.join(
            self.tempdir.path, 'out0002','out0002_input_original.txt')))
開發者ID:rtrwalker,項目名稱:geotecha,代碼行數:9,代碼來源:test_inputoutput.py

示例7: test_check_attributes_that_should_be_lists

    def test_check_attributes_that_should_be_lists(self):
        a = InputFileLoaderCheckerSaver()
        a.a=4
        a.b=6
        a._attributes_that_should_be_lists = ['b']
        a.check_input_attributes()

        assert_equal(a.a, 4)
        assert_equal(a.b, [6])
開發者ID:rtrwalker,項目名稱:geotecha,代碼行數:9,代碼來源:test_inputoutput.py

示例8: test_init_from_str

    def test_init_from_str(self):
        a = InputFileLoaderCheckerSaver()
        a._attributes = "a b".split()
        a._initialize_attributes()
        a.__init__('a=4\nb=6')

        assert_equal(a.a, 4)
        assert_equal(a.b, 6)
        assert_equal(a._input_text, 'a=4\nb=6')
開發者ID:rtrwalker,項目名稱:geotecha,代碼行數:9,代碼來源:test_inputoutput.py

示例9: test_init_from_fileobj

    def test_init_from_fileobj(self):
        a = InputFileLoaderCheckerSaver()
        a._attributes = "a b".split()
        a._initialize_attributes()
        with open(os.path.join(self.tempdir.path, 'inp1.py'), 'r') as f:
            a.__init__(f)

        assert_equal(a.a, 4)
        assert_equal(a.b, 6)
        assert_equal(a._input_text, 'a=4\nb=6')
開發者ID:rtrwalker,項目名稱:geotecha,代碼行數:10,代碼來源:test_inputoutput.py

示例10: test_save_data_parsed

    def test_save_data_parsed(self):
        a = InputFileLoaderCheckerSaver()
        a._attributes = "a b ".split()
        a.save_data_to_file=True
#        a._initialize_attributes()
        a.a=4
        a.b=6

        a._save_data()
#        print(os.listdir(self.tempdir.path))
#        print(os.listdir(os.path.join(self.tempdir.path,'out0002')))
        assert_equal(self.tempdir.read(
                ('out0002','out0002_input_parsed.py'), 'utf-8').strip().splitlines(),
                     'a = 4\nb = 6'.splitlines())
開發者ID:rtrwalker,項目名稱:geotecha,代碼行數:14,代碼來源:test_inputoutput.py

示例11: test_save_figures_figure_ext

    def test_save_figures_figure_ext(self):
        a = InputFileLoaderCheckerSaver()
        a.save_figures_to_file=True
        a.figure_ext='.pdf'

        fig = matplotlib.pyplot.figure()
        ax = fig.add_subplot('111')
        ax.plot(4,5)
        fig.set_label('sing')
        a._figures=[fig]
        a._save_figures()
        a._figures=None
        matplotlib.pyplot.clf()
#        print(os.listdir(os.path.join(self.tempdir.path,'out0002')))
        ok_(os.path.isfile(os.path.join(
            self.tempdir.path, 'out0002','out0002_sing.pdf')))
開發者ID:rtrwalker,項目名稱:geotecha,代碼行數:16,代碼來源:test_inputoutput.py

示例12: test_check_at_least_one

    def test_check_at_least_one(self):
        a = InputFileLoaderCheckerSaver()
        a.c=None
        a._at_least_one = ['c'.split()]

        assert_raises(ValueError, a.check_input_attributes)
開發者ID:rtrwalker,項目名稱:geotecha,代碼行數:6,代碼來源:test_inputoutput.py

示例13: test_check_attributes_that_should_have_same_len_pairs

 def test_check_attributes_that_should_have_same_len_pairs(self):
     a = InputFileLoaderCheckerSaver()
     a.a = [2, 3]
     a.c = [3]
     a._attributes_that_should_have_same_len_pairs = ['a c'.split()]
     assert_raises(ValueError, a.check_input_attributes)
開發者ID:rtrwalker,項目名稱:geotecha,代碼行數:6,代碼來源:test_inputoutput.py

示例14: test_check_attributes_that_should_have_same_x_limits

 def test_check_attributes_that_should_have_same_x_limits(self):
     a = InputFileLoaderCheckerSaver()
     a.a = PolyLine([0,1], [2,5])
     a.c = PolyLine([0,7], [5,6])
     a._attributes_that_should_have_same_x_limits = ['a c'.split()]
     assert_raises(ValueError, a.check_input_attributes)
開發者ID:rtrwalker,項目名稱:geotecha,代碼行數:6,代碼來源:test_inputoutput.py

示例15: test_check_one_implies_others

 def test_check_one_implies_others(self):
     a = InputFileLoaderCheckerSaver()
     a.a = 4
     a.c=None
     a._one_implies_others = ['a c'.split()]
     assert_raises(ValueError, a.check_input_attributes)
開發者ID:rtrwalker,項目名稱:geotecha,代碼行數:6,代碼來源:test_inputoutput.py


注:本文中的geotecha.inputoutput.inputoutput.InputFileLoaderCheckerSaver類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。