大约有 15,500 项符合查询结果(耗时:0.0290秒) [XML]
How do you write tests for the argparse portion of a python module? [closed]
I have a Python module that uses the argparse library. How do I write tests for that section of the code base?
9 Answers
...
How do you test that a Python function throws an exception?
How does one write a unittest that fails only if a function doesn't throw an expected exception?
13 Answers
...
Mock functions in Go
...rl string) string { /* ... */ }
func main() {
downloader(get_page)
}
Test:
func mock_get_page(url string) string {
// mock your 'get_page()' function here
}
func TestDownloader(t *testing.T) {
downloader(mock_get_page)
}
Method2: Make download() a method of a type Downloader:
If you ...
C++ project organisation (with gtest, cmake and doxygen)
...stall on their
platform. CMake comes with a find_package script for Google
Test. This makes things a lot easier. I would go with bundling only
when necessary and avoid it otherwise.
How to build: Avoid in-source builds. CMake makes out of source-builds
easy and it makes life a lot easier.
I suppos...
What are the primary differences between TDD and BDD? [closed]
Test Driven Development has been the rage in the .NET community for the last few years. Recently, I have heard grumblings in the ALT.NET community about BDD. What is it? What makes it different from TDD?
...
How to set JVM parameters for Junit Unit Tests?
I have some Junit unit tests that require a large amount of heap-space to run - i.e. 1G. (They test memory-intensive functionality for a webstart app that will only run with sufficient heap-space, and will be run internally on Win 7 64-bit machines - so redesigning the tests isn't a practical sugges...
How can I unit test a GUI?
The calculations in my code are well-tested, but because there is so much GUI code, my overall code coverage is lower than I'd like. Are there any guidelines on unit-testing GUI code? Does it even make sense?
...
Get context of test project in Android junit test case
Does anyone know how can you get the context of the Test project in Android junit test case (extends AndroidTestCase).
9...
Making code internal but available for unit testing from other projects
We put all of our unit tests in their own projects. We find that we have to make certain classes public instead of internal just for the unit tests. Is there anyway to avoid having to do this. What are the memory implication by making classes public instead of sealed?
...
Are static class variables possible in Python?
...t not inside a method are class or "static" variables:
>>> class Test(object):
... i = 3
...
>>> Test.i
3
There are a few gotcha's here. Carrying on from the example above:
>>> t = Test()
>>> t.i # "static" variable accessed via instance
3
>>>...