|
10 | 10 |
|
11 | 11 | import pytest |
12 | 12 |
|
| 13 | +from typelib import graph |
13 | 14 | from typelib.unmarshals import routines |
14 | 15 |
|
15 | 16 | from tests import models |
@@ -718,44 +719,36 @@ def test_fixed_tuple_unmarshaller( |
718 | 719 |
|
719 | 720 |
|
720 | 721 | @pytest.mark.suite( |
721 | | - dataclass=dict( |
722 | | - given_cls=models.Data, |
| 722 | + context=dict( |
723 | 723 | given_context={ |
724 | | - int: routines.NumberUnmarshaller(int, {}, var="value"), |
725 | | - str: routines.StringUnmarshaller(str, {}, var="field"), |
| 724 | + graph.TypeNode(int, var="value"): routines.NumberUnmarshaller( |
| 725 | + int, {}, var="value" |
| 726 | + ), |
| 727 | + graph.TypeNode(str, var="field"): routines.StringUnmarshaller( |
| 728 | + str, {}, var="field" |
| 729 | + ), |
726 | 730 | }, |
| 731 | + ), |
| 732 | +) |
| 733 | +@pytest.mark.suite( |
| 734 | + dataclass=dict( |
| 735 | + given_cls=models.Data, |
727 | 736 | expected_output=models.Data(field="data", value=1), |
728 | 737 | ), |
729 | 738 | vanilla=dict( |
730 | 739 | given_cls=models.Vanilla, |
731 | | - given_context={ |
732 | | - int: routines.NumberUnmarshaller(int, {}, var="value"), |
733 | | - str: routines.StringUnmarshaller(str, {}, var="field"), |
734 | | - }, |
735 | 740 | expected_output=models.Vanilla(field="data", value=1), |
736 | 741 | ), |
737 | 742 | vanilla_with_hints=dict( |
738 | 743 | given_cls=models.VanillaWithHints, |
739 | | - given_context={ |
740 | | - int: routines.NumberUnmarshaller(int, {}, var="value"), |
741 | | - str: routines.StringUnmarshaller(str, {}, var="field"), |
742 | | - }, |
743 | 744 | expected_output=models.VanillaWithHints(field="data", value=1), |
744 | 745 | ), |
745 | 746 | named_tuple=dict( |
746 | 747 | given_cls=models.NTuple, |
747 | | - given_context={ |
748 | | - int: routines.NumberUnmarshaller(int, {}, var="value"), |
749 | | - str: routines.StringUnmarshaller(str, {}, var="field"), |
750 | | - }, |
751 | 748 | expected_output=models.NTuple(field="data", value=1), |
752 | 749 | ), |
753 | 750 | typed_dict=dict( |
754 | 751 | given_cls=models.TDict, |
755 | | - given_context={ |
756 | | - int: routines.NumberUnmarshaller(int, {}, var="value"), |
757 | | - str: routines.StringUnmarshaller(str, {}, var="field"), |
758 | | - }, |
759 | 752 | expected_output=models.TDict(field="data", value=1), |
760 | 753 | ), |
761 | 754 | ) |
|
0 commit comments