Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 878737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:48:45+00:00 2026-05-15T11:48:45+00:00

Following the example in PyUnit, I came up with the following unittest code that

  • 0

Following the example in PyUnit, I came up with the following unittest code that works fine.

import unittest

class Board:
  def __init__(self, x, y):
    self.x = x; self.y = y;
  def __eq__(self, other):
      return self.x == other.x and self.y == other.y

class BoardTest(unittest.TestCase):
    def setUp(self):
        self.b10_10 = Board(10,10)
        self.b10_10p = Board(10,10)
        self.b10_20 = Board(10,20)
    def tearDown(self):
        pass
    def test1(self):
        self.assert_(self.b10_10 == self.b10_10p)
    def test2(self):
        self.assert_(not (self.b10_10 == self.b10_20))

class BoardTest2(unittest.TestCase):
    def setUp(self):
        self.b10_10 = Board(10,10)
        self.b10_10p = Board(10,10)
        self.b10_20 = Board(10,20)
    def tearDown(self):
        pass
    def test1(self):
        self.assert_(self.b10_10 == self.b10_10p)
    def test2(self):
        self.assert_(not (self.b10_10 == self.b10_20))

def suite():
    suite1 = unittest.makeSuite(BoardTest)
    suite2 = unittest.makeSuite(BoardTest2)
    return unittest.TestSuite((suite1, suite2))

if __name__ == "__main__":
  unittest.main()

But the thing is that even if I remove the

def suite():

, the result is the same. In other words, it looks like that the fixture/suite is not useless with PyUnit.

Is this correct?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:48:46+00:00Added an answer on May 15, 2026 at 11:48 am

    unittest.TestSuite is not necessary if you want to run all the tests in a single module as unittest.main() will dynamically examine the module it is called from and find all classes that derive from unittest.TestCase

    However, the TestSuite class is still handy in a number of scenarios:

    1. You want to build a set of logical groupings of tests. For instance, a suite of unit tests, integration tests, tests for a specific subsystem, etc.
    2. You tests span multiple modules/packages. In this scenario, it is useful to have a single script you can run execute all your tests. This can be accomplished by building up a suite of all your tests. Note that this becomes irrelevant with libraries such as discovery.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following example code: class A(object): def __init__(self, id): self.myid = id
Take following example of code: (ASP.NET WebForms) <asp:Content ContentPlaceHolderID=Contents runat=server> <div class=blogpost-list> <asp:Repeater ID=blogList
The following example works, but how can I change it so that instead of
Consider following example : public class SomeBusinessLayerService : DataService<MyEntityContainer> { [WebInvoke] void DoSomething(string someParam)
In the following example should I expect that values.size() will be called every time
I have the following example class: Test.h: @interface Test : UIButton { NSString *value;
The following example is bad, because it has code repetition. For example, if we
Given the following example, why do I have to explicitly use the statement b->A::DoSomething()
Let me use the following example to explain my question: public string ExampleFunction(string Variable)
I was trying the following example, but with external URLs: Using WebViews The example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.