-
-
Save kyanny/bc7cbf5409b91a965ec4b6682a946e7b to your computer and use it in GitHub Desktop.
Run Django's SimpleTestCase assertion in single Python script (without Django project)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
from django.test import SimpleTestCase | |
from django.conf import settings | |
settings.configure() | |
class InHTMLTestCase(SimpleTestCase): | |
databases = [] | |
def test_ok(self): | |
self.assertInHTML('a', '<div>a</div>') | |
def test_not_ok(self): | |
self.assertInHTML('a', '<div>a<br>b</div>') | |
def test_ok2(self): | |
self.assertInHTML('a<br>b', '<div>a<br>b</div>') | |
if __name__ == '__main__': | |
unittest.main() |
Author
kyanny
commented
Dec 29, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment