Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75156 > unrolled thread

How can I import unnecessary_math?

Started byfl <rxjwg98@gmail.com>
First post2014-07-24 10:33 -0700
Last post2014-07-24 11:42 -0600
Articles 9 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  How can I import unnecessary_math? fl <rxjwg98@gmail.com> - 2014-07-24 10:33 -0700
    Re: How can I import unnecessary_math? Chris Angelico <rosuav@gmail.com> - 2014-07-25 03:37 +1000
      Re: How can I import unnecessary_math? fl <rxjwg98@gmail.com> - 2014-07-24 10:48 -0700
        Re: How can I import unnecessary_math? fl <rxjwg98@gmail.com> - 2014-07-24 10:54 -0700
          Re: How can I import unnecessary_math? Chris Angelico <rosuav@gmail.com> - 2014-07-25 03:58 +1000
            Re: How can I import unnecessary_math? fl <rxjwg98@gmail.com> - 2014-07-24 11:18 -0700
          Re: How can I import unnecessary_math? Terry Reedy <tjreedy@udel.edu> - 2014-07-24 14:17 -0400
          Re: How can I import unnecessary_math? Chris Angelico <rosuav@gmail.com> - 2014-07-25 04:25 +1000
    Re: How can I import unnecessary_math? Ian Kelly <ian.g.kelly@gmail.com> - 2014-07-24 11:42 -0600

#75156 — How can I import unnecessary_math?

Fromfl <rxjwg98@gmail.com>
Date2014-07-24 10:33 -0700
SubjectHow can I import unnecessary_math?
Message-ID<15d1bd3b-48f1-45d8-985c-3a5a3691805b@googlegroups.com>
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



Thanks,





............................................
from nose import with_setup # optional

from unnecessary_math import multiply

def setup_module(module):
    print ("") # this is to get a newline after the dots
    print ("setup_module before anything in this file")

def teardown_module(module):
    print ("teardown_module after everything in this file")

def my_setup_function():
    print ("my_setup_function")

def my_teardown_function():
    print ("my_teardown_function")

[toc] | [next] | [standalone]


#75157

FromChris Angelico <rosuav@gmail.com>
Date2014-07-25 03:37 +1000
Message-ID<mailman.12283.1406223477.18130.python-list@python.org>
In reply to#75156
On Fri, Jul 25, 2014 at 3:33 AM, fl <rxjwg98@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

[toc] | [prev] | [next] | [standalone]


#75159

Fromfl <rxjwg98@gmail.com>
Date2014-07-24 10:48 -0700
Message-ID<c16e2ed2-8e20-409c-b019-808f51544efd@googlegroups.com>
In reply to#75157
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:
> > 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.

[toc] | [prev] | [next] | [standalone]


#75160

Fromfl <rxjwg98@gmail.com>
Date2014-07-24 10:54 -0700
Message-ID<4d6fc183-7d99-42c4-b5f2-99240f0fe32b@googlegroups.com>
In reply to#75159
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'

[toc] | [prev] | [next] | [standalone]


#75161

FromChris Angelico <rosuav@gmail.com>
Date2014-07-25 03:58 +1000
Message-ID<mailman.12285.1406224728.18130.python-list@python.org>
In reply to#75160
On Fri, Jul 25, 2014 at 3:54 AM, fl <rxjwg98@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

[toc] | [prev] | [next] | [standalone]


#75166

Fromfl <rxjwg98@gmail.com>
Date2014-07-24 11:18 -0700
Message-ID<00b8db61-5271-48be-b34c-fa4c7f8f2a80@googlegroups.com>
In reply to#75161
On Thursday, July 24, 2014 1:58:45 PM UTC-4, Chris Angelico wrote:
> On Fri, Jul 25, 2014 at 3:54 AM, fl <rxjw..@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/

[toc] | [prev] | [next] | [standalone]


#75165

FromTerry Reedy <tjreedy@udel.edu>
Date2014-07-24 14:17 -0400
Message-ID<mailman.12289.1406225886.18130.python-list@python.org>
In reply to#75160
On 7/24/2014 1:58 PM, Chris Angelico wrote:
> On Fri, Jul 25, 2014 at 3:54 AM, fl <rxjwg98@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

[toc] | [prev] | [next] | [standalone]


#75167

FromChris Angelico <rosuav@gmail.com>
Date2014-07-25 04:25 +1000
Message-ID<mailman.12290.1406226357.18130.python-list@python.org>
In reply to#75160
On Fri, Jul 25, 2014 at 4:17 AM, Terry Reedy <tjreedy@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

[toc] | [prev] | [next] | [standalone]


#75158

FromIan Kelly <ian.g.kelly@gmail.com>
Date2014-07-24 11:42 -0600
Message-ID<mailman.12284.1406223810.18130.python-list@python.org>
In reply to#75156
On Thu, Jul 24, 2014 at 11:33 AM, fl <rxjwg98@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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web