|
38 | 38 | # SOFTWARE.
|
39 | 39 | import datetime
|
40 | 40 |
|
41 |
| -from . import CPyExtType, CPyExtTestCase, CPyExtFunction, unhandled_error_compare, is_native_object |
| 41 | +from . import CPyExtType, CPyExtTestCase, CPyExtFunction, unhandled_error_compare, is_native_object, IS_MANAGED_LAUNCHER |
42 | 42 |
|
43 | 43 | __dir__ = __file__.rpartition("/")[0]
|
44 | 44 |
|
@@ -618,28 +618,30 @@ def test_write_and_invoke_member(self):
|
618 | 618 | assert tester.getDate() == "foo"
|
619 | 619 |
|
620 | 620 |
|
621 |
| -class TestNativeSubclasses: |
622 |
| - def test_time(self): |
623 |
| - for t in (NativeTimeSubclass, ManagedNativeTimeSubclass): |
624 |
| - x = t(hour=6) |
625 |
| - assert is_native_object(x) |
626 |
| - assert x.hour == 6 |
627 |
| - |
628 |
| - def test_date(self): |
629 |
| - for t in (NativeDateSubclass, ManagedNativeDateSubclass): |
630 |
| - x = t(1992, 4, 11) |
631 |
| - assert is_native_object(x) |
632 |
| - assert x.day == 11 |
633 |
| - |
634 |
| - def test_datetime(self): |
635 |
| - for t in (NativeDateTimeSubclass, ManagedNativeDateTimeSubclass): |
636 |
| - x = t(1992, 4, 11, hour=13) |
637 |
| - assert is_native_object(x) |
638 |
| - assert x.day == 11 |
639 |
| - assert x.hour == 13 |
640 |
| - |
641 |
| - def test_timedelta(self): |
642 |
| - for t in (NativeDeltaSubclass, ManagedNativeDeltaSubclass): |
643 |
| - x = t(hours=6) |
644 |
| - assert is_native_object(x) |
645 |
| - assert x.seconds == 21600 |
| 621 | +# GR-47546: Native subclasses of managed types don't work in managed mode |
| 622 | +if not IS_MANAGED_LAUNCHER: |
| 623 | + class TestNativeSubclasses: |
| 624 | + def test_time(self): |
| 625 | + for t in (NativeTimeSubclass, ManagedNativeTimeSubclass): |
| 626 | + x = t(hour=6) |
| 627 | + assert is_native_object(x) |
| 628 | + assert x.hour == 6 |
| 629 | + |
| 630 | + def test_date(self): |
| 631 | + for t in (NativeDateSubclass, ManagedNativeDateSubclass): |
| 632 | + x = t(1992, 4, 11) |
| 633 | + assert is_native_object(x) |
| 634 | + assert x.day == 11 |
| 635 | + |
| 636 | + def test_datetime(self): |
| 637 | + for t in (NativeDateTimeSubclass, ManagedNativeDateTimeSubclass): |
| 638 | + x = t(1992, 4, 11, hour=13) |
| 639 | + assert is_native_object(x) |
| 640 | + assert x.day == 11 |
| 641 | + assert x.hour == 13 |
| 642 | + |
| 643 | + def test_timedelta(self): |
| 644 | + for t in (NativeDeltaSubclass, ManagedNativeDeltaSubclass): |
| 645 | + x = t(hours=6) |
| 646 | + assert is_native_object(x) |
| 647 | + assert x.seconds == 21600 |
0 commit comments