Is there a mistake? I don't understand why it's not working.
class Form:
def __init__(self, name, pas, email='', link=''):
self.name = name
self.pas = pas
self.email = email
self.link = link
form = Form("Mam", "testpas")
form2 = Form("Dad", "testpas2", "[email protected]", "https://https://stackoverflow.com/")
print(form_url("https://itproger.com"))
Unit test code:
import unittest
import form
class TestForm(unittest.TestCase):
def setUp(self):
self.obj = form.Form()
def test_init(self):
self.assertEqual(self.obj.name, "Mam")
self.assertEqual(self.obj.pas, "testpas")
self.assertEqual(self.obj.name, "Dad")
self.assertEqual(self.obj.pas, "testpas2")
self.assertEqual(self.obj.email, "[email protected]")
self.assertEqual(self.obj.link, "https://https://stackoverflow.com/")
if __name__ == '__main__':
unittest.main()
CodePudding user response:
There are so many mistakes here, but I'll try to start you in the right direction.
class TestForm(unittest.TestCase):
def setUp(self):
self.obj1 = form.form
self.obj2 = form.form2