1# Copyright 2020 The Cirq Developers
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import pathlib
16
17import cirq
18from cirq.json_resolver_cache import _class_resolver_dictionary
19from cirq.testing.json import ModuleJsonTestSpec
20
21TestSpec = ModuleJsonTestSpec(
22    name="cirq",
23    packages=[cirq, cirq.work],
24    test_data_path=pathlib.Path(__file__).parent,
25    resolver_cache=_class_resolver_dictionary(),
26    not_yet_serializable=[
27        'Alignment',
28        'AxisAngleDecomposition',
29        'CircuitDag',
30        'CircuitDiagramInfo',
31        'CircuitDiagramInfoArgs',
32        'CircuitSampleJob',
33        'CliffordSimulatorStepResult',
34        'CliffordTrialResult',
35        'DensityMatrixSimulator',
36        'DensityMatrixSimulatorState',
37        'DensityMatrixStepResult',
38        'DensityMatrixTrialResult',
39        'ExpressionMap',
40        'InsertStrategy',
41        'IonDevice',
42        'KakDecomposition',
43        'LinearCombinationOfGates',
44        'LinearCombinationOfOperations',
45        'Linspace',
46        'ListSweep',
47        'DiagonalGate',
48        'NeutralAtomDevice',
49        'PauliInteractionGate',
50        'PauliStringPhasor',
51        'PauliSum',
52        'PauliSumCollector',
53        'PauliSumExponential',
54        'PauliTransform',
55        'PeriodicValue',
56        'PointOptimizationSummary',
57        'Points',
58        'Product',
59        'QasmArgs',
60        'QasmOutput',
61        'QuantumState',
62        'QubitOrder',
63        'QubitPermutationGate',
64        'QuilFormatter',
65        'QuilOutput',
66        'SimulationTrialResult',
67        'SingleQubitCliffordGate',
68        'SparseSimulatorStep',
69        'StateVectorMixin',
70        'TextDiagramDrawer',
71        'ThreeQubitDiagonalGate',
72        'Timestamp',
73        'TwoQubitDiagonalGate',
74        'UnitSweep',
75        'StateVectorSimulatorState',
76        'StateVectorTrialResult',
77        'ZerosSampler',
78        'Zip',
79    ],
80    should_not_be_serialized=[
81        # Heatmaps
82        'Heatmap',
83        'TwoQubitInteractionHeatmap',
84        # Intermediate states with work buffers and unknown external prng guts.
85        'ActOnArgs',
86        'ActOnArgsContainer',
87        'ActOnCliffordTableauArgs',
88        'ActOnDensityMatrixArgs',
89        'ActOnStabilizerCHFormArgs',
90        'ActOnStateVectorArgs',
91        'ApplyChannelArgs',
92        'ApplyMixtureArgs',
93        'ApplyUnitaryArgs',
94        'OperationTarget',
95        # Circuit optimizers are function-like. Only attributes
96        # are ignore_failures, tolerance, and other feature flags
97        'AlignLeft',
98        'AlignRight',
99        'ConvertToCzAndSingleGates',
100        'ConvertToIonGates',
101        'ConvertToNeutralAtomGates',
102        'DropEmptyMoments',
103        'DropNegligible',
104        'EjectPhasedPaulis',
105        'EjectZ',
106        'ExpandComposite',
107        'MEASUREMENT_KEY_SEPARATOR',
108        'MergeInteractions',
109        'MergeInteractionsToSqrtIswap',
110        'MergeSingleQubitGates',
111        'PointOptimizer',
112        'SynchronizeTerminalMeasurements',
113        # global objects
114        'CONTROL_TAG',
115        'PAULI_BASIS',
116        'PAULI_STATES',
117        # abstract, but not inspect.isabstract():
118        'Device',
119        'InterchangeableQubitsGate',
120        'Pauli',
121        'SingleQubitGate',
122        'ThreeQubitGate',
123        'TwoQubitGate',
124        'ABCMetaImplementAnyOneOf',
125        'GenericMetaImplementAnyOneOf',
126        'SimulatesAmplitudes',
127        'SimulatesExpectationValues',
128        'SimulatesFinalState',
129        # protocols:
130        'SupportsActOn',
131        'SupportsActOnQubits',
132        'SupportsApplyChannel',
133        'SupportsApplyMixture',
134        'SupportsApproximateEquality',
135        'SupportsChannel',
136        'SupportsCircuitDiagramInfo',
137        'SupportsCommutes',
138        'SupportsConsistentApplyUnitary',
139        'SupportsDecompose',
140        'SupportsDecomposeWithQubits',
141        'SupportsEqualUpToGlobalPhase',
142        'SupportsExplicitHasUnitary',
143        'SupportsExplicitNumQubits',
144        'SupportsExplicitQidShape',
145        'SupportsJSON',
146        'SupportsMeasurementKey',
147        'SupportsMixture',
148        'SupportsParameterization',
149        'SupportsPauliExpansion',
150        'SupportsPhase',
151        'SupportsQasm',
152        'SupportsQasmWithArgs',
153        'SupportsQasmWithArgsAndQubits',
154        'SupportsTraceDistanceBound',
155        'SupportsUnitary',
156        # mypy types:
157        'CIRCUIT_LIKE',
158        'DURATION_LIKE',
159        'JsonResolver',
160        'NOISE_MODEL_LIKE',
161        'OP_TREE',
162        'PAULI_GATE_LIKE',
163        'PAULI_STRING_LIKE',
164        'ParamResolverOrSimilarType',
165        'PauliSumLike',
166        'QUANTUM_STATE_LIKE',
167        'QubitOrderOrList',
168        'RANDOM_STATE_OR_SEED_LIKE',
169        'STATE_VECTOR_LIKE',
170        'Sweepable',
171        'TParamKey',
172        'TParamVal',
173        'ParamDictType',
174        # utility:
175        'CliffordSimulator',
176        'Simulator',
177        'StabilizerSampler',
178        'Unique',
179        'DEFAULT_RESOLVERS',
180    ],
181    deprecated={},
182)
183