Re: How can I import unnecessary_math?

2014-07-24 Thread Chris Angelico
On Fri, Jul 25, 2014 at 3:33 AM, fl rxjw...@gmail.com wrote:
 Hi,
 I want to write some test code. Some on-line tutorials have such codes:


 from unnecessary_math import multiply

Which tutorials? That's where you'll find the answer to your question.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How can I import unnecessary_math?

2014-07-24 Thread Ian Kelly
On Thu, Jul 24, 2014 at 11:33 AM, fl rxjw...@gmail.com wrote:
 Hi,
 I want to write some test code. Some on-line tutorials have such codes:


 from unnecessary_math import multiply

 When it runs, it has errors:

 from unnecessary_math import multiply
 Traceback (most recent call last):
   File interactive input, line 1, in module
 ImportError: No module named unnecessary_math

 I have not found anywhere to download it. What explanation about the module:

 from unnecessary_math import multiply

A little bit of searching turns up this:

https://github.com/okken/markdown.py/blob/master/simple_example/unnecessary_math.py

It appears to be used as a simple example library for a doctesting demo.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How can I import unnecessary_math?

2014-07-24 Thread fl
On Thursday, July 24, 2014 1:37:49 PM UTC-4, Chris Angelico wrote:
 On Fri, Jul 25, 2014 at 3:33 AM, fl r...@gmail.com wrote:
  Hi,
  I want to write some test code. Some on-line tutorials have such codes:
 
 
  from unnecessary_math import multiply
 Which tutorials? That's where you'll find the answer to your question.
 ChrisA

Thanks. The source of that snippet is from this link:

http://pythontesting.net/framework/nose/nose-introduction/


I do not find any idea on that module yet.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How can I import unnecessary_math?

2014-07-24 Thread fl
On Thursday, July 24, 2014 1:48:02 PM UTC-4, fl wrote:
 On Thursday, July 24, 2014 1:37:49 PM UTC-4, Chris Angelico wrote:
 
  On Fri, Jul 25, 2014 at 3:33 AM, fl rx...@gmail.com wrote:
 
 Thanks. The source of that snippet is from this link:
 
 
 http://pythontesting.net/framework/nose/nose-introduction/
 
 
 I do not find any idea on that module yet.

It is also a question about the symbol '@' on that link.

I don't find an explanation about '@' yet. Could you tell me?

Thanks,



@with_setup(my_setup_function, my_teardown_function)
def test_numbers_3_4():
print 'test_numbers_3_4   actual test code'
assert multiply(3,4) == 12

@with_setup(my_setup_function, my_teardown_function)
def test_strings_a_3():
print 'test_strings_a_3   actual test code'
assert multiply('a',3) == 'aaa'
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How can I import unnecessary_math?

2014-07-24 Thread Chris Angelico
On Fri, Jul 25, 2014 at 3:54 AM, fl rxjw...@gmail.com wrote:
 It is also a question about the symbol '@' on that link.

 I don't find an explanation about '@' yet. Could you tell me?

 Thanks,



 @with_setup(my_setup_function, my_teardown_function)
 def test_numbers_3_4():
 print 'test_numbers_3_4   actual test code'
 assert multiply(3,4) == 12


That's a function decorator. You can look them up on the web now that
you know what they're called. :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How can I import unnecessary_math?

2014-07-24 Thread Terry Reedy

On 7/24/2014 1:58 PM, Chris Angelico wrote:

On Fri, Jul 25, 2014 at 3:54 AM, fl rxjw...@gmail.com wrote:

It is also a question about the symbol '@' on that link.

I don't find an explanation about '@' yet. Could you tell me?


The Python docs have an index. I STRONGLY recommend that everyone learn 
to use it. The index starts with a Symbols page.

https://docs.python.org/3/genindex-Symbols.html
The page may not be complete yet (I plan to recheck sometime), but it 
has an entry for '@'. If you do not want to search the page for '@', 
your browser find function (typically control-F) should find it for you. 
That entry takes you to

https://docs.python.org/3/reference/compound_stmts.html#index-20


@with_setup(my_setup_function, my_teardown_function)
def test_numbers_3_4():
 print 'test_numbers_3_4   actual test code'
 assert multiply(3,4) == 12



That's a function decorator. You can look them up on the web now that
you know what they're called. :)


The Symbol index page was added to make knowing names unnecessary.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: How can I import unnecessary_math?

2014-07-24 Thread fl
On Thursday, July 24, 2014 1:58:45 PM UTC-4, Chris Angelico wrote:
 On Fri, Jul 25, 2014 at 3:54 AM, fl rxj...@gmail.com wrote:
  @with_setup(my_setup_function, my_teardown_function)
  def test_numbers_3_4():
  print 'test_numbers_3_4   actual test code'
  assert multiply(3,4) == 12
 
 That's a function decorator. You can look them up on the web now that
 
 you know what they're called. :)
 
 
 ChrisA

Thanks, I find the source of unnecessary_math at 
http://pythontesting.net/framework/doctest/doctest-introduction/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How can I import unnecessary_math?

2014-07-24 Thread Chris Angelico
On Fri, Jul 25, 2014 at 4:17 AM, Terry Reedy tjre...@udel.edu wrote:
 That's a function decorator. You can look them up on the web now that
 you know what they're called. :)


 The Symbol index page was added to make knowing names unnecessary.

And I clock this up on my learn something every day list. Was not
aware of that. Not surprised to know that it exists (it's certainly
far from unheard-of), but I wasn't specifically aware of it.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list