11# Copyright (c) Microsoft Corporation.
22# Licensed under the MIT license.
33
4- """Tests that every symbol in __all__ is importable from each package namespace."""
4+ """Tests that every symbol in __all__ is importable from each package namespace,
5+ and that re-exported objects are identical to their originals."""
56
67import unittest
78
@@ -15,6 +16,27 @@ def test_all_symbols_importable(self):
1516 for name in m .__all__ :
1617 self .assertTrue (hasattr (m , name ), f"{ name !r} is in __all__ but missing from PowerPlatform.Dataverse.core" )
1718
19+ def test_identity (self ):
20+ """Re-exported objects are the same objects as their source definitions."""
21+ import PowerPlatform .Dataverse .core as m
22+ from PowerPlatform .Dataverse .core .config import DataverseConfig
23+ from PowerPlatform .Dataverse .core .errors import (
24+ DataverseError ,
25+ HttpError ,
26+ MetadataError ,
27+ SQLParseError ,
28+ ValidationError ,
29+ )
30+ from PowerPlatform .Dataverse .core .log_config import LogConfig
31+
32+ self .assertIs (m .DataverseConfig , DataverseConfig )
33+ self .assertIs (m .DataverseError , DataverseError )
34+ self .assertIs (m .HttpError , HttpError )
35+ self .assertIs (m .MetadataError , MetadataError )
36+ self .assertIs (m .SQLParseError , SQLParseError )
37+ self .assertIs (m .ValidationError , ValidationError )
38+ self .assertIs (m .LogConfig , LogConfig )
39+
1840
1941class TestModelsExports (unittest .TestCase ):
2042 """Every name in PowerPlatform.Dataverse.models.__all__ must be importable."""
@@ -25,6 +47,38 @@ def test_all_symbols_importable(self):
2547 for name in m .__all__ :
2648 self .assertTrue (hasattr (m , name ), f"{ name !r} is in __all__ but missing from PowerPlatform.Dataverse.models" )
2749
50+ def test_identity (self ):
51+ """Re-exported objects are the same objects as their source definitions."""
52+ import PowerPlatform .Dataverse .models as m
53+ from PowerPlatform .Dataverse .models .batch import BatchItemResponse , BatchResult
54+ from PowerPlatform .Dataverse .models .query_builder import ExpandOption , QueryBuilder , QueryParams
55+ from PowerPlatform .Dataverse .models .record import Record
56+ from PowerPlatform .Dataverse .models .relationship import (
57+ CascadeConfiguration ,
58+ LookupAttributeMetadata ,
59+ ManyToManyRelationshipMetadata ,
60+ OneToManyRelationshipMetadata ,
61+ RelationshipInfo ,
62+ )
63+ from PowerPlatform .Dataverse .models .table_info import AlternateKeyInfo , ColumnInfo , TableInfo
64+ from PowerPlatform .Dataverse .models .upsert import UpsertItem
65+
66+ self .assertIs (m .BatchItemResponse , BatchItemResponse )
67+ self .assertIs (m .BatchResult , BatchResult )
68+ self .assertIs (m .ExpandOption , ExpandOption )
69+ self .assertIs (m .QueryBuilder , QueryBuilder )
70+ self .assertIs (m .QueryParams , QueryParams )
71+ self .assertIs (m .Record , Record )
72+ self .assertIs (m .CascadeConfiguration , CascadeConfiguration )
73+ self .assertIs (m .LookupAttributeMetadata , LookupAttributeMetadata )
74+ self .assertIs (m .ManyToManyRelationshipMetadata , ManyToManyRelationshipMetadata )
75+ self .assertIs (m .OneToManyRelationshipMetadata , OneToManyRelationshipMetadata )
76+ self .assertIs (m .RelationshipInfo , RelationshipInfo )
77+ self .assertIs (m .AlternateKeyInfo , AlternateKeyInfo )
78+ self .assertIs (m .ColumnInfo , ColumnInfo )
79+ self .assertIs (m .TableInfo , TableInfo )
80+ self .assertIs (m .UpsertItem , UpsertItem )
81+
2882
2983class TestOperationsExports (unittest .TestCase ):
3084 """Every name in PowerPlatform.Dataverse.operations.__all__ must be importable."""
@@ -37,6 +91,39 @@ def test_all_symbols_importable(self):
3791 hasattr (m , name ), f"{ name !r} is in __all__ but missing from PowerPlatform.Dataverse.operations"
3892 )
3993
94+ def test_identity (self ):
95+ """Re-exported objects are the same objects as their source definitions."""
96+ import PowerPlatform .Dataverse .operations as m
97+ from PowerPlatform .Dataverse .operations .batch import (
98+ BatchDataFrameOperations ,
99+ BatchOperations ,
100+ BatchQueryOperations ,
101+ BatchRecordOperations ,
102+ BatchRequest ,
103+ BatchTableOperations ,
104+ ChangeSet ,
105+ ChangeSetRecordOperations ,
106+ )
107+ from PowerPlatform .Dataverse .operations .dataframe import DataFrameOperations
108+ from PowerPlatform .Dataverse .operations .files import FileOperations
109+ from PowerPlatform .Dataverse .operations .query import QueryOperations
110+ from PowerPlatform .Dataverse .operations .records import RecordOperations
111+ from PowerPlatform .Dataverse .operations .tables import TableOperations
112+
113+ self .assertIs (m .BatchDataFrameOperations , BatchDataFrameOperations )
114+ self .assertIs (m .BatchOperations , BatchOperations )
115+ self .assertIs (m .BatchQueryOperations , BatchQueryOperations )
116+ self .assertIs (m .BatchRecordOperations , BatchRecordOperations )
117+ self .assertIs (m .BatchRequest , BatchRequest )
118+ self .assertIs (m .BatchTableOperations , BatchTableOperations )
119+ self .assertIs (m .ChangeSet , ChangeSet )
120+ self .assertIs (m .ChangeSetRecordOperations , ChangeSetRecordOperations )
121+ self .assertIs (m .DataFrameOperations , DataFrameOperations )
122+ self .assertIs (m .FileOperations , FileOperations )
123+ self .assertIs (m .QueryOperations , QueryOperations )
124+ self .assertIs (m .RecordOperations , RecordOperations )
125+ self .assertIs (m .TableOperations , TableOperations )
126+
40127
41128if __name__ == "__main__" :
42129 unittest .main ()
0 commit comments