当前位置: 首页>>代码示例>>Python>>正文


Python trivial.assert_equal函数代码示例

本文整理汇总了Python中nose.tools.trivial.assert_equal函数的典型用法代码示例。如果您正苦于以下问题:Python assert_equal函数的具体用法?Python assert_equal怎么用?Python assert_equal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了assert_equal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_area

    def test_area(self):

        assert_equal(integrate_f_over_polygon_code(1).splitlines(),
                     'def ifxy(pts):\n    "Integrate f = 1 over '
                     'polygon"\n\n    x, y, z = xyz_from_pts(pts, True)'
                     '\n\n    return np.sum((x[:-1]/2 + x[1:]/2)*(-y[:-1] '
                     '+ y[1:]))'.splitlines())
开发者ID:mikyes,项目名称:geotecha,代码行数:7,代码来源:test_geometry.py

示例2: test_to_dict_recursive_circular

def test_to_dict_recursive_circular():

    class Brother(TInterface):

        _dict_attrs = (
            'name',
            'siblings'
        )

        def __init__(self, name):
            self.name = name
            self.siblings = []

        def __repr__(self):
            return 'Brother: %s' % (self.name)

    tom = Brother('tom')
    jerry = Brother('jerry')
    tom.siblings.append(jerry)
    jerry.siblings.append(tom)

    result = to_dict_recursive(tom)
    result2 = to_dict_recursive(jerry)

    assert_equal(
        result,
        {'name': 'tom', 'siblings': [{'name': 'jerry', 'siblings': []}]}
    )

    assert_equal(
        result2,
        {'name': 'jerry', 'siblings': [{'name': 'tom', 'siblings': []}]}
    )
开发者ID:petermelias,项目名称:mrpython,代码行数:33,代码来源:test_fxn.py

示例3: test_defaults

    def test_defaults(self):
        fig = plot_single_material_vs_depth((self.a, self.b), self.xlabels)

        assert_equal(len(fig.get_axes()), 2)
        ax1 = fig.get_axes()[0]
        line1= ax1.get_lines()[0]

        ax2 = fig.get_axes()[1]
        line2 = ax2.get_lines()[0]

        assert_allclose(line1.get_xydata()[0],
                     np.array([ 1., 0.]))
        assert_allclose(line1.get_xydata()[-1],
                     np.array([ 2., 1]))

        assert_allclose(line2.get_xydata()[0],
                     np.array([ 2., 0.]))
        assert_allclose(line2.get_xydata()[-1],
                     np.array([ 3., 1]))

        assert_equal(ax1.get_xlabel(), 'a')
        assert_equal(ax2.get_xlabel(), 'b')

        assert_equal(ax1.get_ylabel(), 'Depth, z')
        assert_equal(ax2.get_ylabel(), '')
开发者ID:mikyes,项目名称:geotecha,代码行数:25,代码来源:test_one_d.py

示例4: test_initialize_objects_attributes

def test_initialize_objects_attributes():
    """test for initialize_objects_attributes function"""
    #initialize_objects_attributes(obj, attributes=[], defaults = dict(),  not_found_value = None):

    a = EmptyClass()
    initialize_objects_attributes(a,attributes=['a','b'], defaults={'a': 6})
    assert_equal([a.a,a.b],[6,None])
开发者ID:rtrwalker,项目名称:geotecha,代码行数:7,代码来源:test_inputoutput.py

示例5: test_prop_dict_ylabel

    def test_prop_dict_ylabel(self):
        fig = plot_single_material_vs_depth((self.a, self.b),
                                            self.xlabels,
                                            prop_dict={'ylabel': 'hello'})
        ax1 = fig.get_axes()[0]

        assert_equal(ax1.get_ylabel(), 'hello')
开发者ID:mikyes,项目名称:geotecha,代码行数:7,代码来源:test_one_d.py

示例6: 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

示例7: test_propdict_has_legend

    def test_propdict_has_legend(self):


        fig = plot_vs_depth(self.x, self.z, ['a', 'b', 'c'],
                           prop_dict={'has_legend': False})
        ax = fig.get_axes()[0]

        assert_equal(ax.get_legend(), None)
开发者ID:mikyes,项目名称:geotecha,代码行数:8,代码来源:test_one_d.py

示例8: 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

示例9: test_propdict_legend_prop_title

 def test_propdict_legend_prop_title(self):
     fig = plot_generic_loads([[self.triple1], [self.triple2]],
                               load_names=self.load_names,
                        prop_dict={'legend_prop':{'title':'abc'}})
     ax1 = fig.get_axes()[0]
     ax3 = fig.get_axes()[2]
     assert_equal(ax1.get_legend().get_title().get_text(), 'abc')
     assert_equal(ax3.get_legend().get_title().get_text(), 'abc')
开发者ID:mikyes,项目名称:geotecha,代码行数:8,代码来源:test_one_d.py

示例10: test_copy_dict

def test_copy_dict():
    """test for copy_dict"""
    #copy_dict(source_dict, diffs)
#    ok_(copy_dict({'a':7, 'b':12}, {'c':13})=={'a':7, 'b':12, 'c':13})
    assert_equal(copy_dict({'a':7, 'b':12}, {'c':13}),
                 {'a':7, 'b':12, 'c':13})
#    ok_(copy_dict({'a':7, 'b':12}, {'a':21, 'c':13})=={'a':21, 'b':12, 'c':13})
    assert_equal(copy_dict({'a':7, 'b':12}, {'a':21, 'c':13}),
                 {'a':21, 'b':12, 'c':13})
开发者ID:mikyes,项目名称:geotecha,代码行数:9,代码来源:test_one_d.py

示例11: 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

示例12: test_propdict_xylabels

    def test_propdict_xylabels(self):


        fig = plot_vs_depth(self.x, self.z, ['a', 'b', 'c'],
                           prop_dict={'xlabel':'xxx', 'ylabel':'yyy'})
        ax = fig.get_axes()[0]

        assert_equal(ax.get_xlabel(), 'xxx')
        assert_equal(ax.get_ylabel(), 'yyy')
开发者ID:mikyes,项目名称:geotecha,代码行数:9,代码来源:test_one_d.py

示例13: test_split_sequence_into_dict_and_nondicts

def test_split_sequence_into_dict_and_nondicts():
    """test for split_sequence_into_dict_and_nondicts"""
    #split_sequence_into_dict_and_nondicts(*args)

    assert_equal(split_sequence_into_dict_and_nondicts({'a': 2, 'b': 3},
                                   4,
                                   {'a':8, 'c':5},
                                   5),
                                   ([4,5], {'a': 8, 'b': 3, 'c':5}))
开发者ID:mikyes,项目名称:geotecha,代码行数:9,代码来源:test_one_d.py

示例14: test_prop_dict_depth_axis_label

    def test_prop_dict_depth_axis_label(self):
        fig = plot_generic_loads([[self.triple1], [self.triple2]],
                                  load_names=self.load_names,
                           prop_dict={'depth_axis_label': 'hello'})

        ax2 = fig.get_axes()[1]
        ax4 = fig.get_axes()[3]
        assert_equal(ax2.get_xlabel(), '')
        assert_equal(ax4.get_xlabel(), 'hello')
开发者ID:mikyes,项目名称:geotecha,代码行数:9,代码来源:test_one_d.py

示例15: test_prop_dict_time_axis_label

    def test_prop_dict_time_axis_label(self):
        fig = plot_generic_loads([[self.triple1], [self.triple2]],
                                  load_names=self.load_names,
                           prop_dict={'time_axis_label': 'hello'})

        ax1 = fig.get_axes()[0]
        ax3 = fig.get_axes()[2]
        assert_equal(ax1.get_xlabel(), '')
        assert_equal(ax3.get_xlabel(), 'hello')
开发者ID:mikyes,项目名称:geotecha,代码行数:9,代码来源:test_one_d.py


注:本文中的nose.tools.trivial.assert_equal函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。