From 0435a7b890367ab46052265c14ff1a394833f326 Mon Sep 17 00:00:00 2001 From: Brandon Rodriguez <brodriguez8774@gmail.com> Date: Sat, 16 Jul 2022 19:21:14 -0400 Subject: [PATCH] Further fixes for import error corrections Seems fine now, maybe? --- django_dump_die/templatetags/dump_die.py | 7 +++++-- tests/test_views.py | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/django_dump_die/templatetags/dump_die.py b/django_dump_die/templatetags/dump_die.py index e5fc4f5..1cc2268 100644 --- a/django_dump_die/templatetags/dump_die.py +++ b/django_dump_die/templatetags/dump_die.py @@ -137,10 +137,13 @@ def dump_object( intermediate_value = safe_str(obj) # Handle if obj is a simple type (Null/None, int, str, bool, and basic number types) - # OR if direct parent is a intermediate (excluding pytz timezone objects). + # OR if direct parent is an intermediate (excluding pytz timezone objects). elif ( _is_simple_type(obj) - or (PYTZ_PRESENT and parent_is_intermediate and not isinstance(obj, pytz.BaseTzInfo)) + or ( + (PYTZ_PRESENT and parent_is_intermediate and not isinstance(obj, pytz.BaseTzInfo)) + or parent_is_intermediate + ) ): return _handle_simple_type(obj) diff --git a/tests/test_views.py b/tests/test_views.py index 796a495..0a453b8 100644 --- a/tests/test_views.py +++ b/tests/test_views.py @@ -1763,7 +1763,7 @@ class DumpDieIntermediateTypeTestCase(GenericViewTestCase): '<hr>', ], content_starts_after='sample_dt_timedelta', - content_ends_before='sample_pytz_timezone', + content_ends_before='Python pathlib examples:', ) @unittest.skipIf(not PYTZ_PRESENT, 'Pytz not present. Likely Django >= 4.0.') @@ -1852,7 +1852,7 @@ class DumpDieIntermediateTypeTestCase(GenericViewTestCase): '<hr>', ], content_starts_after='sample_tz_timedelta', - content_ends_before='sample_zoneinfo_timezone', + content_ends_before='Python pathlib examples:', ) @unittest.skipIf(not ZONEINFO_PRESENT, 'ZoneInfo not present. Likely Python < 3.9.') @@ -1940,7 +1940,7 @@ class DumpDieIntermediateTypeTestCase(GenericViewTestCase): '<hr>', ], - content_starts_after='sample_pytz_timezone', + content_starts_after='sample_tz_timedelta', content_ends_before='Python pathlib examples:', ) -- GitLab