• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tools.wrap_nb函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_fraction_from_decimal

def test_fraction_from_decimal():
    """Are decimal fractions created correctly from decimals?"""
    assert Fraction(Decimal('0.56')).printed == wrap_nb('\\frac{56}{100}')
    assert Fraction(Decimal('0.938')).printed == wrap_nb('\\frac{938}{1000}')
    assert Fraction(Decimal('0.4')).printed == wrap_nb('\\frac{4}{10}')
    assert Fraction(Decimal('2.17')).printed == wrap_nb('\\frac{217}{100}')
    assert Fraction(Decimal('4')).printed == wrap_nb('\\frac{40}{10}')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:7,代码来源:test_003_fractions.py


示例2: test_q4_printed

def test_q4_printed(q4):
    """Is this Quotient correctly printed?"""
    assert q4.printed == wrap_nb('(6+36)\div 14')
    q4_next = q4.expand_and_reduce_next_step()
    assert q4_next.printed == wrap_nb('42\\div 14')
    q4_next = q4_next.expand_and_reduce_next_step()
    assert q4_next.printed == wrap_nb('3')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:7,代码来源:test_012_quotients.py


示例3: test_t2_into_crossproduct_eq

def test_t2_into_crossproduct_eq(t2, ABC):
    """Are the literals in this table correctly substituted?"""
    t2.substitute({AngleItem(from_this_angle=ABC): Value(32),
                   Value('EF'): Value(9)})
    assert t2.printed == \
        wrap_nb('cos(32)=\\frac{\\text{EG}}{9}')
    assert t2.into_crossproduct_equation().printed == \
        wrap_nb('cos(32)=\\frac{\\text{EG}}{9}')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:8,代码来源:test_050_tables.py


示例4: test_eq32_autoresolution

def test_eq32_autoresolution():
    """Is this Equation correctly auto-resolved?"""
    eq = Equation((Monomial(('+', 1, 1)), SquareRoot(Item(16))))
    assert eq.auto_resolution(dont_display_equations_name=True,
                              decimal_result=2) == \
        wrap_nb('\[x=\\sqrt{\mathstrut 16}\]'
                '\[x=4\]')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:7,代码来源:test_041_equations.py


示例5: test_cpeq0_autoresolution_ter

def test_cpeq0_autoresolution_ter(cpeq0):
    """Is this Equation correctly auto-resolved?"""
    assert cpeq0.auto_resolution(dont_display_equations_name=True,
                                 skip_fraction_simplification=True) == \
        wrap_nb('\[\\frac{\\text{AB}}{4}=\\frac{3}{8}\]'
                '\[\\text{AB}=\\frac{3\\times 4}{8}\]'
                '\[\\text{AB}=\\frac{3}{2}\]')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:7,代码来源:test_042_cross_product_equations.py


示例6: test_eq15_autoresolution

def test_eq15_autoresolution():
    """Is this Equation correctly auto-resolved?"""
    eq = Equation((Item(1), Item(2)), number=1)
    assert eq.auto_resolution() == wrap_nb('$(\\text{E}_{1}): $'
                                           '\[1=2\]'
                                           'This equation has no solution.'
                                           '\\newline ')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:7,代码来源:test_041_equations.py


示例7: test_expL_auto_er

def test_expL_auto_er(expL):
    """Is this Expression correctly expanded and reduced?"""
    assert expL.auto_expansion_and_reduction() == \
        wrap_nb('$\\text{L}=-2-x+8x^{2}+x$\\newline \n'
                '$\\text{L}=-2+(-1+1)x+8x^{2}$\\newline \n'
                '$\\text{L}=-2+0x+8x^{2}$\\newline \n'
                '$\\text{L}=-2+8x^{2}$\\newline \n')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:7,代码来源:test_040_expansion_reduction.py


示例8: test_eq24_autoresolution

def test_eq24_autoresolution(eq24):
    """Is this Equation correctly auto-resolved?"""
    eq = eq24
    assert eq.auto_resolution() == wrap_nb('$(\\text{E}_{1}): $'
                                           '\[x=4^{2}+5^{2}\]'
                                           '\[x=16+25\]'
                                           '\[x=41\]')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:7,代码来源:test_041_equations.py


示例9: test_tup0_printed

def test_tup0_printed(tup0):
    """Is this table correctly printed?"""
    assert tup0.printed == \
        wrap_nb('\\begin{tabular}{|c|c|c|}\n\hline \n'
                '2&\n\\text{AB}&\n6\\\\\n\\hline \n'
                '3.4&\n8.5&\n\\text{MN}\\\\\n\\hline \n'
                '\end{tabular}\n')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:7,代码来源:test_052_tables_uncomplete_proportional.py


示例10: test_f6_simplification_line

def test_f6_simplification_line():
    """Is this Fraction's simplification line correct?"""
    assert Fraction(('+',
                     Product([Item(10), Item(5)]),
                     Product([Item(5), Item(9)])))\
        .simplification_line().printed == \
        wrap_nb('\\frac{10\\times \\bcancel{5}}{\\bcancel{5}\\times 9}')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:7,代码来源:test_003_fractions.py


示例11: test_tup1_printed

def test_tup1_printed(tup1):
    """Is this table correctly printed?"""
    assert tup1.printed == \
        wrap_nb('\\begin{tabular}{|c|c|c|c|}\n\hline \n'
                '2&\n\\text{AB}&\n\\text{EF}&\n4\\\\\n\\hline \n'
                '2.5&\n\\text{CD}&\n3.75&\n\\text{GH}\\\\\n\\hline \n'
                '\end{tabular}\n')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:7,代码来源:test_052_tables_uncomplete_proportional.py


示例12: test_tup2_printed

def test_tup2_printed(tup2):
    """Is this table correctly printed?"""
    assert tup2.printed == \
        wrap_nb('\\begin{tabular}{|c|c|c|}\n\hline \n'
                '\\text{AB}&\n4&\n9\\\\\n\\hline \n'
                '2.4&\n3.2&\n\\text{MN}\\\\\n\\hline \n'
                '\end{tabular}\n')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:7,代码来源:test_052_tables_uncomplete_proportional.py


示例13: test_eq42_autoresolution3

def test_eq42_autoresolution3(eq42):
    """Is 4x = 11/60 correctly auto-resolved?"""
    assert eq42.auto_resolution(dont_display_equations_name=True,
                                details_level='none') == wrap_nb(
        '\[4x=\\frac{11}{60}\]'
        '\[x=\\frac{11}{60}\div 4\]'
        '\[x=\\frac{11}{240}\]')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:7,代码来源:test_041_equations.py


示例14: test_eq34_autoresolution

def test_eq34_autoresolution(eq34):
    """Is this Equation correctly auto-resolved?"""
    eq = eq34
    assert eq.auto_resolution(dont_display_equations_name=True) == \
        wrap_nb('\[x^{2}=5\]'
                '\[x=\\sqrt{\mathstrut 5} '
                'or x=-\\sqrt{\mathstrut 5}\]')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:7,代码来源:test_041_equations.py


示例15: test_expI_auto_er

def test_expI_auto_er(expI):
    """Is this Expression correctly expanded and reduced?"""
    assert expI.auto_expansion_and_reduction() == \
        wrap_nb('$\\text{I}=4x+(-15x+8-5x)$\\newline \n'
                '$\\text{I}=4x-15x+8-5x$\\newline \n'
                '$\\text{I}=(4-15-5)x+8$\\newline \n'
                '$\\text{I}=-16x+8$\\newline \n')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:7,代码来源:test_040_expansion_reduction.py


示例16: test_expF_auto_er

def test_expF_auto_er(expF):
    """Is this Expression correctly expanded and reduced?"""
    assert expF.auto_expansion_and_reduction() == \
        wrap_nb('$\\text{F}=-2\\times (-6)-1+3\\times (-x)-8x\\times '
                '(-3)$\\newline \n'
                '$\\text{F}=12-1-3x+24x$\\newline \n'
                '$\\text{F}=11+(-3+24)x$\\newline \n'
                '$\\text{F}=11+21x$\\newline \n')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:8,代码来源:test_040_expansion_reduction.py


示例17: test_complicated_sum_02

def test_complicated_sum_02():
    """Is this Sum correctly printed as (6+x)^{2}+12(2+11x)?"""
    assert Sum([BinomialIdentity((Monomial(('+', 6, 0)),
                                  Monomial(('+', 1, 1)))),
                Expandable((Monomial(('+', 12, 0)),
                            Sum([Polynomial([Monomial(('+', 2, 0)),
                                             Monomial(('+', 11, 1))])])
                            ))]).printed == wrap_nb('(6+x)^{2}+12(2+11x)')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:8,代码来源:test_010_sums.py


示例18: test_eq42_autoresolution

def test_eq42_autoresolution(eq42):
    """Is 4x = 11/60 correctly auto-resolved?"""
    assert eq42.auto_resolution(dont_display_equations_name=True) == wrap_nb(
        '\[4x=\\frac{11}{60}\]'
        '\[x=\\frac{11}{60}\div 4\]'
        '\[x=\\frac{11}{60}\\times \\frac{1}{4}\]'
        '\[x=\\frac{11\\times 1}{60\\times 4}\]'
        '\[x=\\frac{11}{240}\]')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:8,代码来源:test_041_equations.py


示例19: test_expE_auto_er

def test_expE_auto_er(expE):
    """Is this Expression correctly expanded and reduced?"""
    assert expE.auto_expansion_and_reduction() == \
        wrap_nb('$\\text{E}=-3\\times 10-10x\\times (-9x)+7x\\times '
                '8x+8\\times 10$\\newline \n'
                '$\\text{E}=-30+90x^{2}+56x^{2}+80$\\newline \n'
                '$\\text{E}=-30+80+(90+56)x^{2}$\\newline \n'
                '$\\text{E}=50+146x^{2}$\\newline \n')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:8,代码来源:test_040_expansion_reduction.py


示例20: test_cpeq0_autoresolution

def test_cpeq0_autoresolution(cpeq0):
    """Is this Equation correctly auto-resolved?"""
    assert cpeq0.auto_resolution(dont_display_equations_name=True) == \
        wrap_nb('\[\\frac{\\text{AB}}{4}=\\frac{3}{8}\]'
                '\[\\text{AB}=\\frac{3\\times 4}{8}\]'
                '\[\\text{AB}=\\frac{3\\times \\bcancel{4}}'
                '{\\bcancel{4}\\times 2}\]'
                '\[\\text{AB}=\\frac{3}{2}\]')
开发者ID:nicolashainaux,项目名称:mathmaker,代码行数:8,代码来源:test_042_cross_product_equations.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python unit.mock_response函数代码示例发布时间:2022-05-27
下一篇:
Python tools.spawn_process函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap