Jelajahi Sumber

Simplified consecutive calls to pathlib.Path.parent.

Jon Dufresne 5 tahun lalu
induk
melakukan
607004f81a

+ 1 - 1
django/contrib/admin/bin/compress.py

@@ -11,7 +11,7 @@ except ImportError:
 else:
     closure_compiler = closure.get_jar_filename()
 
-js_path = Path(__file__).parent.parent / 'static' / 'admin' / 'js'
+js_path = Path(__file__).parents[1] / 'static' / 'admin' / 'js'
 
 
 def main():

+ 1 - 1
tests/view_tests/tests/test_debug.py

@@ -757,7 +757,7 @@ class PlainTextReportTests(SimpleTestCase):
             exc_type, exc_value, tb = sys.exc_info()
         reporter = ExceptionReporter(request, exc_type, exc_value, tb)
         text = reporter.get_traceback_text()
-        templ_path = Path(Path(__file__).parent.parent, 'templates', 'debug', 'template_error.html')
+        templ_path = Path(Path(__file__).parents[1], 'templates', 'debug', 'template_error.html')
         self.assertIn(
             'Template error:\n'
             'In template %(path)s, error at line 2\n'