|
by: |
last post by:
I just ran this stuff for my own knowledge. Though it might be
useful to some other people to know and maybe spark a discussion.
I needed a fast way to test for membership, so naturally the
choices were the builtin containers: lists, dictionaries, and
tuples. The following is the test code and results:
import timeit
lst_i=timeit.Timer('random.randrange(10000) in l','import
|
by: Alan G Isaac |
last post by:
> python doctest.py -v
Running doctest.__doc__
Trying: .remove(42)
Expecting:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: list.remove(x): x not in list
ok
Trying: x = 12
Expecting: nothing
|
by: Michele Simionato |
last post by:
Some time ago I hacked a custom solution to run doctests
on text files containing documentation. The solution
involved this kind of game:
tester=doctest.Tester(globs={},verbose=1)
tester.runstring(mytest)
It worked fine, but now with Python 2.4.a3 I get
DeprecationWarning: class Tester is deprecated; use class
|
by: mitchell |
last post by:
Is it possible to store doctest's verbose output to a variable?
For example:
import doctest, my_test_module
a = doctest.testmod(my_test_module)
The contents of 'a' is the tuple of passed and failed results. I tried
passing verbose mode to the testmod function, but 'a' is still a tuple.
|
by: Michele Simionato |
last post by:
I am getting a strange error with this script:
$ cat doctest-threads.py
"""
>>> import time, threading
>>> def example():
.... thread.out =
.... while thread.running:
.... time.sleep(.01)
.... thread.out.append(".")
|
|
by: thomas.guest |
last post by:
I'm not making progress with the following and would appreciate any
help.
Here's an interpreted Python session.
....
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'f' is not defined
|
by: Bzyczek |
last post by:
Hello,
I have problems with running doctests if I use czech national
characters in UTF-8 encoding.
I have Python script, which begin with encoding definition:
# -*- coding: utf-8 -*-
I have this function with doctest:
|
by: brad |
last post by:
Does anyone else feel that unittesting is too much work? Not in general,
just the official unittest module for small to medium sized projects?
It seems easier to write some quick methods that are used when needed
rather than building a program with integrated unittesting. I see the
value of it (the official unittest that is)... especially when there's a
lot of source code. But this...
if len(x) != y:
sys.exit('...')
|
by: Matthew Fitzgibbons |
last post by:
I'm by no means a testing expert, but I'll take a crack at it.
Casey McGinty wrote:
I've never run into this.
Rule of thumb: always separate software from hardware. Write mock
classes or functions that do your hardware/file access that always
return known data (but remember to test for alpha and beta errors--make
sure both valid and invalid data are handled correctly). That way you
can test the client code that is accessing the...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
|