本文整理汇总了Python中tests.tools.wrap_nb函数的典型用法代码示例。如果您正苦于以下问题:Python wrap_nb函数的具体用法?Python wrap_nb怎么用?Python wrap_nb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wrap_nb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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}')
示例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')
示例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}')
示例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\]')
示例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}\]')
示例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 ')
示例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')
示例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\]')
示例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')
示例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}')
示例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')
示例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')
示例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}\]')
示例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}\]')
示例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')