#32959: URLValidator test cases can be defined in a Python module -------------------------------------+------------------------------------- Reporter: Chris Jerdonek | Owner: nobody Type: | Status: new Cleanup/optimization | Component: Testing framework | Version: dev Severity: Normal | Resolution: Keywords: | Triage Stage: | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Description changed by Chris Jerdonek:
Old description: > I noticed that the URLValidator tests have a number of test cases defined > in separate text files (`valid_urls.txt` and `invalid_urls.txt`): > https://github.com/django/django/blob/012f38f9594b35743e9ab231757b7b62db638323/tests/validators/tests.py > > However, it seems like it would be more maintainable if these test cases > were defined in a Python module (e.g. the same `tests.py` file containing > the test code). One reason is that there aren't actually that many test > cases to warrant a separate file. Another is that having them as part of > a Python module would permit them to be annotated with code comments. > Currently, none of the test cases have any comments elaborating on what > they're testing, and having them in a text file precludes that > possibility. Finally, if there are any concerns about mistranscribing > from the text files to a Python module, the transcription could be done > with a Python script to eliminate the possibility of transcription > errors. New description: I noticed that the URLValidator tests have a number of test cases defined in separate text files (`valid_urls.txt` and `invalid_urls.txt`): https://github.com/django/django/tree/012f38f9594b35743e9ab231757b7b62db638323/tests/validators However, it seems like it would be more maintainable if these test cases were defined in a Python module (e.g. the same `tests.py` file containing the test code). One reason is that there aren't actually that many test cases to warrant a separate file. Another is that having them as part of a Python module would permit them to be annotated with code comments. Currently, none of the test cases have any comments elaborating on what they're testing, and having them in a text file precludes that possibility. Finally, if there are any concerns about mistranscribing from the text files to a Python module, the transcription could be done with a Python script to eliminate the possibility of transcription errors. -- -- Ticket URL: <https://code.djangoproject.com/ticket/32959#comment:1> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.d3a7fc6689e3be1f1b7ca6028363704f%40djangoproject.com.