Python Forum
How would you test this module?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How would you test this module?
#3
Here is the starting point of a testing file, assuming the initial file is tagfoo.py
# file testtagfoo.py
import unittest as ut
from tagfoo import tagify, tag

class TestTagify(ut.TestCase):
    def test_simple_image_tag(self):
        rv = tagify('image', 'An Image', src='filename.jpg')
        self.assertEqual(
            rv,
            '<image src="filename.jpg">An Image</image>')
        
if __name__ == '__main__':
    ut.main()
You can add methods test_... to the TestTagify class, and create new classes.
Reply


Messages In This Thread
How would you test this module? - by RickyWilson - Dec-26-2017, 04:49 PM
RE: How would you test this module? - by nilamo - Jan-04-2018, 07:34 PM
RE: How would you test this module? - by Gribouillis - Jan-04-2018, 10:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to test and import a model form computer to test accuracy using Sklearn library Anldra12 6 3,311 Jul-03-2021, 10:07 AM
Last Post: Anldra12
  How to write test cases for a init function by Unit test in python? binhduonggttn 2 3,242 Feb-24-2020, 12:06 PM
Last Post: Larz60+
  How to write test cases by Unit test for database configuration file? binhduonggttn 0 2,640 Feb-18-2020, 08:03 AM
Last Post: binhduonggttn

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020