/
test_args.py
2188 lines (1270 loc) · 62.4 KB
/
test_args.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""Test whether all elements of cls.args are instances of Basic."""
# NOTE: keep tests sorted by (module, class name) key.
import inspect
import os
import re
import warnings
from diofant import (ITE, Add, Adjoint, And, Atom, AtomicExpr, Basic,
BlockDiagMatrix, BlockMatrix, Complement, Contains,
Derivative, Determinant, DiagonalMatrix, DiagonalOf, Dict,
Dummy, Equality, Equivalent, Expr, FiniteSet, Float,
FunctionMatrix, GrayCode, GreaterThan, GroebnerBasis,
HadamardProduct, Identity, Idx, ImageSet, ImmutableMatrix,
ImmutableSparseMatrix, Implies, Indexed, IndexedBase,
Integer, IntegerPartition, Integral, Intersection,
Interval, Inverse, Lambda, LessThan, Limit, MatAdd,
MatMul, MatPow, MatrixSlice, MatrixSymbol, Mod, Mul, Nand,
Nor, Not, Number, Or, Order, Partition, Permutation,
PermutationGroup, Poly, Polyhedron, Pow, Product,
ProductSet, Prufer, PurePoly, Range, Rational, RootOf,
RootSum, S, Set, StrictGreaterThan, StrictLessThan, Subs,
Subset, Sum, Symbol, SymmetricDifference, Trace,
Transpose, Tuple, Unequality, Union, Wild, WildFunction,
Xor, ZeroMatrix, divisor_sigma, false, mobius, oo, sin,
symbols, totient, true)
from diofant.abc import a, b, c, w, x, y, z
from diofant.concrete.expr_with_intlimits import ExprWithIntLimits
from diofant.concrete.expr_with_limits import AddWithLimits, ExprWithLimits
from diofant.core.function import Application, AppliedUndef
from diofant.core.numbers import (Catalan, ComplexInfinity, EulerGamma, Exp1,
GoldenRatio, Half, ImaginaryUnit, Infinity,
NaN, NegativeInfinity, NegativeOne,
NumberSymbol, One, Pi, Zero)
from diofant.core.trace import Tr
from diofant.diffgeom import (BaseCovarDerivativeOp, BaseScalarField,
BaseVectorField, Commutator, CoordSystem,
CovarDerivativeOp, Differential, LieDerivative,
Manifold, Patch)
from diofant.diffgeom import Point as DiffgeomPoint
from diofant.diffgeom import TensorProduct, WedgeProduct
from diofant.functions import (Chi, Ci, DiracDelta, Ei, FallingFactorial,
Heaviside, KroneckerDelta, LambertW, LeviCivita,
Li, Max, Min, Piecewise, RisingFactorial, Shi,
Si, Ynm, Znm, acos, acosh, acot, acoth, acsc,
adjoint, airyai, airyaiprime, airybi,
airybiprime, arg, asec, asin, asinh,
assoc_laguerre, assoc_legendre, atan, atan2,
atanh, bell, bernoulli, besseli, besselj,
besselk, bessely, beta, binomial, catalan,
ceiling, chebyshevt, chebyshevt_root,
chebyshevu, chebyshevu_root, conjugate, cos,
cosh, cot, coth, csc, csch, dirichlet_eta,
elliptic_e, elliptic_f, elliptic_k, elliptic_pi,
erf, erf2, erf2inv, erfc, erfcinv, erfi, erfinv,
euler, exp, exp_polar, expint, factorial,
factorial2, fibonacci, floor, fresnelc,
fresnels, gamma, gegenbauer, genocchi, hankel1,
hankel2, harmonic, hermite, hyper, im, jacobi,
jn, laguerre, legendre, lerchphi, li, log,
loggamma, lowergamma, lucas, meijerg,
periodic_argument, polar_lift, polygamma,
polylog, principal_branch)
from diofant.functions import re as _re
from diofant.functions import (sec, sech, sign, sinh, subfactorial, tan, tanh,
transpose, uppergamma, yn, zeta)
from diofant.functions.elementary.miscellaneous import IdentityFunction
from diofant.functions.elementary.piecewise import ExprCondPair
from diofant.functions.special.error_functions import _erfs
from diofant.functions.special.hyper import (HyperRep_asin1, HyperRep_asin2,
HyperRep_atanh, HyperRep_cosasin,
HyperRep_log1, HyperRep_log2,
HyperRep_power1, HyperRep_power2,
HyperRep_sinasin, HyperRep_sqrts1,
HyperRep_sqrts2)
from diofant.geometry import (Circle, Curve, Ellipse, Line, Point, Polygon,
Ray, RegularPolygon, Segment, Triangle)
from diofant.geometry.entity import GeometryEntity
from diofant.integrals.risch import NonElementaryIntegral
from diofant.integrals.transforms import (CosineTransform, FourierTransform,
HankelTransform,
InverseCosineTransform,
InverseFourierTransform,
InverseHankelTransform,
InverseLaplaceTransform,
InverseMellinTransform,
InverseSineTransform,
LaplaceTransform, MellinTransform,
SineTransform)
from diofant.logic.boolalg import BooleanFunction
from diofant.matrices.expressions.fourier import DFT, IDFT
from diofant.matrices.expressions.matexpr import MatrixElement
from diofant.printing.codeprinter import Assignment
from diofant.sets.fancysets import (ExtendedReals, Integers, Naturals,
Naturals0, Rationals, Reals)
from diofant.sets.sets import EmptySet, UniversalSet
from diofant.simplify.hyperexpand import G_Function, Hyper_Function
from diofant.stats.crv import (ConditionalContinuousDomain,
ContinuousDistributionHandmade,
ContinuousDomain, ContinuousPSpace,
ProductContinuousDomain,
ProductContinuousPSpace, SingleContinuousDomain,
SingleContinuousPSpace)
from diofant.stats.crv_types import (ArcsinDistribution, BeniniDistribution,
BetaDistribution, BetaPrimeDistribution,
CauchyDistribution, ChiDistribution,
ChiNoncentralDistribution,
ChiSquaredDistribution, DagumDistribution,
ExponentialDistribution,
FDistributionDistribution,
FisherZDistribution, FrechetDistribution,
GammaDistribution,
GammaInverseDistribution,
KumaraswamyDistribution,
LaplaceDistribution, LogisticDistribution,
LogNormalDistribution,
MaxwellDistribution, NakagamiDistribution,
Normal, NormalDistribution,
ParetoDistribution,
QuadraticUDistribution,
RaisedCosineDistribution,
RayleighDistribution,
StudentTDistribution,
TriangularDistribution,
UniformDistribution,
UniformSumDistribution,
VonMisesDistribution, WeibullDistribution,
WignerSemicircleDistribution)
from diofant.stats.drv import SingleDiscreteDomain, SingleDiscretePSpace
from diofant.stats.drv_types import GeometricDistribution, PoissonDistribution
from diofant.stats.frv import (ConditionalFiniteDomain, FiniteDomain,
FinitePSpace, ProductFiniteDomain,
ProductFinitePSpace, SingleFiniteDomain,
SingleFinitePSpace)
from diofant.stats.frv_types import (BernoulliDistribution,
BinomialDistribution, DieDistribution,
DiscreteUniformDistribution,
FiniteDistributionHandmade,
HypergeometricDistribution,
RademacherDistribution)
from diofant.stats.rv import (ConditionalDomain, Density, ProductDomain,
ProductPSpace, PSpace, RandomDomain,
RandomSymbol, SingleDomain)
from diofant.tensor import ImmutableDenseNDimArray, ImmutableSparseNDimArray
from diofant.tensor.tensor import (TensAdd, TensorHead, TensorIndex,
TensorIndexType, TensorSymmetry, TensorType,
get_symmetric_group_sgs, tensor_indices)
from diofant.utilities.exceptions import DiofantDeprecationWarning
from diofant.vector import (AxisOrienter, BaseDyadic, BaseScalar, BaseVector,
BodyOrienter, CoordSysCartesian, Del, DyadicAdd,
DyadicMul, DyadicZero)
from diofant.vector import Point as VPoint
from diofant.vector import (QuaternionOrienter, SpaceOrienter, VectorAdd,
VectorMul, VectorZero)
__all__ = ()
def test_all_classes_are_tested():
this = os.path.split(__file__)[0]
path = os.path.join(this, os.pardir, os.pardir)
diofant_path = os.path.abspath(path)
prefix = os.path.split(diofant_path)[0] + os.sep
re_cls = re.compile(r'^class ([A-Za-z][A-Za-z0-9_]*)\s*\(', re.MULTILINE)
modules = {}
for root, dirs, files in os.walk(diofant_path):
module = root.replace(prefix, '').replace(os.sep, '.')
for file in files:
if file.startswith(('_', 'test_', 'bench_')):
continue
if not file.endswith('.py'):
continue
with open(os.path.join(root, file), encoding='utf-8') as f:
text = f.read()
submodule = module + '.' + file[:-3]
names = re_cls.findall(text)
if not names:
continue
try:
mod = __import__(submodule, fromlist=names)
except ImportError:
continue
def is_Basic(name):
cls = getattr(mod, name)
return issubclass(cls, Basic)
names = list(filter(is_Basic, names))
if names:
modules[submodule] = names
ns = globals()
failed = []
for module, names in modules.items():
mod = module.replace('.', '__')
for name in names:
test = 'test_' + mod + '__' + name
if test not in ns:
failed.append(module + '.' + name)
# reset all DiofantDeprecationWarning into errors
warnings.simplefilter('error', category=DiofantDeprecationWarning)
assert not failed, f"Missing classes: {', '.join(failed)}. Please add tests for these to diofant/core/tests/test_args.py."
def _test_args(obj):
all_basic = all(isinstance(arg, Basic) for arg in obj.args)
# Ideally obj.func(*obj.args) would always recreate the object, but for
# now, we only require it for objects with non-empty .args
recreatable = not obj.args or obj.func(*obj.args) == obj
res = all_basic and recreatable
if hasattr(obj, 'doit'):
doit = obj.doit
if inspect.ismethod(doit):
spec = inspect.getfullargspec(doit)
res &= (len(spec.args) == 1 and spec.varargs is None
and spec.varkw is not None)
else:
res &= False
return res
def test_diofant__combinatorics__graycode__GrayCode():
# an integer is given and returned from GrayCode as the arg
assert _test_args(GrayCode(3, start='100'))
assert _test_args(GrayCode(3, rank=1))
def test_diofant__combinatorics__subsets__Subset():
assert _test_args(Subset([0, 1], [0, 1, 2, 3]))
assert _test_args(Subset(['c', 'd'], ['a', 'b', 'c', 'd']))
def test_diofant__combinatorics__permutations__Permutation():
assert _test_args(Permutation([0, 1, 2, 3]))
def test_diofant__combinatorics__perm_groups__PermutationGroup():
assert _test_args(PermutationGroup([Permutation([0, 1])]))
def test_diofant__combinatorics__polyhedron__Polyhedron():
pgroup = [Permutation([[0, 1, 2], [3]]),
Permutation([[0, 1, 3], [2]]),
Permutation([[0, 2, 3], [1]]),
Permutation([[1, 2, 3], [0]]),
Permutation([[0, 1], [2, 3]]),
Permutation([[0, 2], [1, 3]]),
Permutation([[0, 3], [1, 2]]),
Permutation([[0, 1, 2, 3]])]
corners = [w, x, y, z]
faces = [(w, x, y), (w, y, z), (w, z, x), (x, y, z)]
assert _test_args(Polyhedron(corners, faces, pgroup))
def test_diofant__combinatorics__prufer__Prufer():
assert _test_args(Prufer([[0, 1], [0, 2], [0, 3]], 4))
def test_diofant__combinatorics__partitions__Partition():
assert _test_args(Partition([1]))
def test_diofant__combinatorics__partitions__IntegerPartition():
assert _test_args(IntegerPartition([1]))
def test_diofant__concrete__products__Product():
assert _test_args(Product(x, (x, 0, 10)))
assert _test_args(Product(x, (x, 0, y), (y, 0, 10)))
def test_diofant__concrete__expr_with_limits__ExprWithLimits():
assert _test_args(ExprWithLimits(x, (x, 0, 10)))
assert _test_args(ExprWithLimits(x*y, (x, 0, 10.), (y, 1., 3)))
def test_diofant__concrete__expr_with_limits__AddWithLimits():
assert _test_args(AddWithLimits(x, (x, 0, 10)))
assert _test_args(AddWithLimits(x*y, (x, 0, 10), (y, 1, 3)))
def test_diofant__concrete__expr_with_intlimits__ExprWithIntLimits():
assert _test_args(ExprWithIntLimits(x, (x, 0, 10)))
assert _test_args(ExprWithIntLimits(x*y, (x, 0, 10), (y, 1, 3)))
def test_diofant__concrete__summations__Sum():
assert _test_args(Sum(x, (x, 0, 10)))
assert _test_args(Sum(x, (x, 0, y), (y, 0, 10)))
def test_diofant__core__add__Add():
assert _test_args(Add(x, y, z, 2))
def test_diofant__core__basic__Atom():
assert _test_args(Atom())
def test_diofant__core__basic__Basic():
assert _test_args(Basic())
def test_diofant__core__containers__Dict():
assert _test_args(Dict({x: y, y: z}))
def test_diofant__core__containers__Tuple():
assert _test_args(Tuple(x, y, z, 2))
def test_diofant__core__expr__AtomicExpr():
assert _test_args(AtomicExpr())
def test_diofant__core__expr__Expr():
assert _test_args(Expr())
def test_diofant__core__function__Application():
assert _test_args(Application(1, 2, 3))
def test_diofant__core__function__AppliedUndef():
assert _test_args(AppliedUndef(1, 2, 3))
def test_diofant__core__function__Derivative():
assert _test_args(Derivative(2, x, (y, 3)))
def test_diofant__core__function__Function():
pass
def test_diofant__core__function__Lambda():
assert _test_args(Lambda((x, y), x + y + z))
def test_diofant__core__function__Subs():
assert _test_args(Subs(x + y, (x, 2)))
assert _test_args(Subs(x + y, (x, 2), (y, 1)))
def test_diofant__core__function__WildFunction():
assert _test_args(WildFunction('f'))
def test_diofant__core__mod__Mod():
assert _test_args(Mod(x, 2))
def test_diofant__core__mul__Mul():
assert _test_args(Mul(2, x, y, z))
def test_diofant__core__numbers__Catalan():
assert _test_args(Catalan())
def test_diofant__core__numbers__ComplexInfinity():
assert _test_args(ComplexInfinity())
def test_diofant__core__numbers__EulerGamma():
assert _test_args(EulerGamma())
def test_diofant__core__numbers__Exp1():
assert _test_args(Exp1())
def test_diofant__core__numbers__Float():
assert _test_args(Float(1.23))
def test_diofant__core__numbers__GoldenRatio():
assert _test_args(GoldenRatio())
def test_diofant__core__numbers__Half():
assert _test_args(Half())
def test_diofant__core__numbers__ImaginaryUnit():
assert _test_args(ImaginaryUnit())
def test_diofant__core__numbers__Infinity():
assert _test_args(Infinity())
def test_diofant__core__numbers__Integer():
assert _test_args(Integer(7))
def test_diofant__core__numbers__IntegerConstant():
pass
def test_diofant__core__numbers__NaN():
assert _test_args(NaN())
def test_diofant__core__numbers__NegativeInfinity():
assert _test_args(NegativeInfinity())
def test_diofant__core__numbers__NegativeOne():
assert _test_args(NegativeOne())
def test_diofant__core__numbers__Number():
assert _test_args(Number(1, 7))
def test_diofant__core__numbers__NumberSymbol():
assert _test_args(NumberSymbol())
def test_diofant__core__numbers__One():
assert _test_args(One())
def test_diofant__core__numbers__Pi():
assert _test_args(Pi())
def test_diofant__core__numbers__Rational():
assert _test_args(Rational(1, 7))
def test_diofant__core__numbers__RationalConstant():
pass
def test_diofant__core__numbers__Zero():
assert _test_args(Zero())
def test_diofant__core__operations__AssocOp():
pass
def test_diofant__core__operations__LatticeOp():
pass
def test_diofant__core__power__Pow():
assert _test_args(Pow(x, 2))
def test_diofant__core__relational__Equality():
assert _test_args(Equality(x, 2))
def test_diofant__core__relational__GreaterThan():
assert _test_args(GreaterThan(x, 2))
def test_diofant__core__relational__LessThan():
assert _test_args(LessThan(x, 2))
def test_diofant__core__relational__Relational():
pass
def test_diofant__core__relational__StrictGreaterThan():
assert _test_args(StrictGreaterThan(x, 2))
def test_diofant__core__relational__StrictLessThan():
assert _test_args(StrictLessThan(x, 2))
def test_diofant__core__relational__Unequality():
assert _test_args(Unequality(x, 2))
def test_diofant__sets__sets__EmptySet():
assert _test_args(EmptySet())
def test_diofant__sets__sets__UniversalSet():
assert _test_args(UniversalSet())
def test_diofant__sets__sets__FiniteSet():
assert _test_args(FiniteSet(x, y, z))
def test_diofant__sets__sets__Interval():
assert _test_args(Interval(0, 1))
def test_diofant__sets__sets__ProductSet():
assert _test_args(ProductSet(Interval(0, 1), Interval(0, 1)))
def test_diofant__sets__sets__Set():
assert _test_args(Set())
def test_diofant__sets__sets__Intersection():
assert _test_args(Intersection(Interval(0, 3), Interval(2, x)))
def test_diofant__sets__sets__Union():
assert _test_args(Union(Interval(0, 1), Interval(2, 3)))
def test_diofant__sets__sets__Complement():
assert _test_args(Complement(Interval(0, 2), Interval(0, 1)))
def test_diofant__sets__sets__SymmetricDifference():
assert _test_args(SymmetricDifference(FiniteSet(1, 2, 3),
FiniteSet(2, 3, 4)))
def test_diofant__core__trace__Tr():
a, b = symbols('a b')
assert _test_args(Tr(a + b))
def test_diofant__sets__fancysets__Naturals():
assert _test_args(Naturals())
def test_diofant__sets__fancysets__Naturals0():
assert _test_args(Naturals0())
def test_diofant__sets__fancysets__Integers():
assert _test_args(Integers())
def test_diofant__sets__fancysets__Rationals():
assert _test_args(Rationals())
def test_diofant__sets__fancysets__Reals():
assert _test_args(Reals())
def test_diofant__sets__fancysets__ExtendedReals():
assert _test_args(ExtendedReals())
def test_diofant__sets__fancysets__ImageSet():
x = Symbol('x')
assert _test_args(ImageSet(Lambda(x, x**2), S.Naturals))
def test_diofant__sets__fancysets__Range():
assert _test_args(Range(1, 5, 1))
def test_diofant__sets__contains__Contains():
assert _test_args(Contains(x, Range(0, 10, 2)))
# STATS
nd = NormalDistribution(0, 1)
die = DieDistribution(6)
def test_diofant__stats__crv__ContinuousDomain():
assert _test_args(ContinuousDomain({x}, Interval(-oo, oo)))
def test_diofant__stats__crv__SingleContinuousDomain():
assert _test_args(SingleContinuousDomain(x, Interval(-oo, oo)))
def test_diofant__stats__crv__ProductContinuousDomain():
D = SingleContinuousDomain(x, Interval(-oo, oo))
E = SingleContinuousDomain(y, Interval(0, oo))
assert _test_args(ProductContinuousDomain(D, E))
def test_diofant__stats__crv__ConditionalContinuousDomain():
D = SingleContinuousDomain(x, Interval(-oo, oo))
assert _test_args(ConditionalContinuousDomain(D, x > 0))
def test_diofant__stats__crv__ContinuousPSpace():
D = SingleContinuousDomain(x, Interval(-oo, oo))
assert _test_args(ContinuousPSpace(D, nd))
def test_diofant__stats__crv__SingleContinuousPSpace():
assert _test_args(SingleContinuousPSpace(x, nd))
def test_diofant__stats__crv__ProductContinuousPSpace():
A = SingleContinuousPSpace(x, nd)
B = SingleContinuousPSpace(y, nd)
assert _test_args(ProductContinuousPSpace(A, B))
def test_diofant__stats__crv__SingleContinuousDistribution():
pass
def test_diofant__stats__drv__SingleDiscreteDomain():
assert _test_args(SingleDiscreteDomain(x, S.Naturals))
def test_diofant__stats__drv__SingleDiscretePSpace():
assert _test_args(SingleDiscretePSpace(x, PoissonDistribution(1)))
def test_diofant__stats__drv__SingleDiscreteDistribution():
pass
def test_diofant__stats__rv__RandomDomain():
assert _test_args(RandomDomain(FiniteSet(x), FiniteSet(1, 2, 3)))
def test_diofant__stats__rv__SingleDomain():
assert _test_args(SingleDomain(x, FiniteSet(1, 2, 3)))
def test_diofant__stats__rv__ConditionalDomain():
D = RandomDomain(FiniteSet(x), FiniteSet(1, 2))
assert _test_args(ConditionalDomain(D, x > 1))
def test_diofant__stats__rv__PSpace():
D = RandomDomain(FiniteSet(x), FiniteSet(1, 2, 3, 4, 5, 6))
assert _test_args(PSpace(D, die))
def test_diofant__stats__rv__SinglePSpace():
pass
def test_diofant__stats__rv__RandomSymbol():
A = SingleContinuousPSpace(x, nd)
assert _test_args(RandomSymbol(A, x))
def test_diofant__stats__rv__ProductPSpace():
A = SingleContinuousPSpace(x, nd)
B = SingleContinuousPSpace(y, nd)
assert _test_args(ProductPSpace(A, B))
def test_diofant__stats__rv__ProductDomain():
D = SingleDomain(x, Interval(-oo, oo))
E = SingleDomain(y, Interval(0, oo))
assert _test_args(ProductDomain(D, E))
def test_diofant__stats__frv_types__DiscreteUniformDistribution():
assert _test_args(DiscreteUniformDistribution(Tuple(*range(6))))
def test_diofant__stats__frv_types__DieDistribution():
assert _test_args(DieDistribution(6))
def test_diofant__stats__frv_types__BernoulliDistribution():
assert _test_args(BernoulliDistribution(Rational(1, 2), 0, 1))
def test_diofant__stats__frv_types__BinomialDistribution():
assert _test_args(BinomialDistribution(5, Rational(1, 2), 1, 0))
def test_diofant__stats__frv_types__HypergeometricDistribution():
assert _test_args(HypergeometricDistribution(10, 5, 3))
def test_diofant__stats__frv_types__RademacherDistribution():
assert _test_args(RademacherDistribution())
def test_diofant__stats__frv__FiniteDomain():
assert _test_args(FiniteDomain({(x, 1), (x, 2)})) # x can be 1 or 2
def test_diofant__stats__frv__SingleFiniteDomain():
assert _test_args(SingleFiniteDomain(x, {1, 2})) # x can be 1 or 2
def test_diofant__stats__frv__ProductFiniteDomain():
xd = SingleFiniteDomain(x, {1, 2})
yd = SingleFiniteDomain(y, {1, 2})
assert _test_args(ProductFiniteDomain(xd, yd))
def test_diofant__stats__frv__ConditionalFiniteDomain():
xd = SingleFiniteDomain(x, {1, 2})
assert _test_args(ConditionalFiniteDomain(xd, x > 1))
def test_diofant__stats__frv__FinitePSpace():
xd = SingleFiniteDomain(x, {1, 2, 3, 4, 5, 6})
xd = SingleFiniteDomain(x, {1, 2})
assert _test_args(FinitePSpace(xd, {(x, 1): Rational(1, 2), (x, 2): Rational(1, 2)}))
def test_diofant__stats__frv__SingleFinitePSpace():
assert _test_args(SingleFinitePSpace(Symbol('x'), die))
def test_diofant__stats__frv__ProductFinitePSpace():
xp = SingleFinitePSpace(Symbol('x'), die)
yp = SingleFinitePSpace(Symbol('y'), die)
assert _test_args(ProductFinitePSpace(xp, yp))
def test_diofant__stats__frv__SingleFiniteDistribution():
pass
def test_diofant__stats__crv__ContinuousDistribution():
pass
def test_diofant__stats__frv_types__FiniteDistributionHandmade():
assert _test_args(FiniteDistributionHandmade({1: 1}))
def test_diofant__stats__crv__ContinuousDistributionHandmade():
assert _test_args(ContinuousDistributionHandmade(Symbol('x'),
Interval(0, 2)))
def test_diofant__stats__rv__Density():
assert _test_args(Density(Normal('x', 0, 1)))
def test_diofant__stats__crv_types__ArcsinDistribution():
assert _test_args(ArcsinDistribution(0, 1))
def test_diofant__stats__crv_types__BeniniDistribution():
assert _test_args(BeniniDistribution(1, 1, 1))
def test_diofant__stats__crv_types__BetaDistribution():
assert _test_args(BetaDistribution(1, 1))
def test_diofant__stats__crv_types__BetaPrimeDistribution():
assert _test_args(BetaPrimeDistribution(1, 1))
def test_diofant__stats__crv_types__CauchyDistribution():
assert _test_args(CauchyDistribution(0, 1))
def test_diofant__stats__crv_types__ChiDistribution():
assert _test_args(ChiDistribution(1))
def test_diofant__stats__crv_types__ChiNoncentralDistribution():
assert _test_args(ChiNoncentralDistribution(1, 1))
def test_diofant__stats__crv_types__ChiSquaredDistribution():
assert _test_args(ChiSquaredDistribution(1))
def test_diofant__stats__crv_types__DagumDistribution():
assert _test_args(DagumDistribution(1, 1, 1))
def test_diofant__stats__crv_types__ExponentialDistribution():
assert _test_args(ExponentialDistribution(1))
def test_diofant__stats__crv_types__FDistributionDistribution():
assert _test_args(FDistributionDistribution(1, 1))
def test_diofant__stats__crv_types__FisherZDistribution():
assert _test_args(FisherZDistribution(1, 1))
def test_diofant__stats__crv_types__FrechetDistribution():
assert _test_args(FrechetDistribution(1, 1, 1))
def test_diofant__stats__crv_types__GammaInverseDistribution():
assert _test_args(GammaInverseDistribution(1, 1))
def test_diofant__stats__crv_types__GammaDistribution():
assert _test_args(GammaDistribution(1, 1))
def test_diofant__stats__crv_types__KumaraswamyDistribution():
assert _test_args(KumaraswamyDistribution(1, 1))
def test_diofant__stats__crv_types__LaplaceDistribution():
assert _test_args(LaplaceDistribution(0, 1))
def test_diofant__stats__crv_types__LogisticDistribution():
assert _test_args(LogisticDistribution(0, 1))
def test_diofant__stats__crv_types__LogNormalDistribution():
assert _test_args(LogNormalDistribution(0, 1))
def test_diofant__stats__crv_types__MaxwellDistribution():
assert _test_args(MaxwellDistribution(1))
def test_diofant__stats__crv_types__NakagamiDistribution():
assert _test_args(NakagamiDistribution(1, 1))
def test_diofant__stats__crv_types__NormalDistribution():
assert _test_args(NormalDistribution(0, 1))
def test_diofant__stats__crv_types__ParetoDistribution():
assert _test_args(ParetoDistribution(1, 1))
def test_diofant__stats__crv_types__QuadraticUDistribution():
assert _test_args(QuadraticUDistribution(1, 2))
def test_diofant__stats__crv_types__RaisedCosineDistribution():
assert _test_args(RaisedCosineDistribution(1, 1))
def test_diofant__stats__crv_types__RayleighDistribution():
assert _test_args(RayleighDistribution(1))
def test_diofant__stats__crv_types__StudentTDistribution():
assert _test_args(StudentTDistribution(1))
def test_diofant__stats__crv_types__TriangularDistribution():
assert _test_args(TriangularDistribution(-1, 0, 1))
def test_diofant__stats__crv_types__UniformDistribution():
assert _test_args(UniformDistribution(0, 1))
def test_diofant__stats__crv_types__UniformSumDistribution():
assert _test_args(UniformSumDistribution(1))
def test_diofant__stats__crv_types__VonMisesDistribution():
assert _test_args(VonMisesDistribution(1, 1))
def test_diofant__stats__crv_types__WeibullDistribution():
assert _test_args(WeibullDistribution(1, 1))
def test_diofant__stats__crv_types__WignerSemicircleDistribution():
assert _test_args(WignerSemicircleDistribution(1))
def test_diofant__stats__drv_types__PoissonDistribution():
assert _test_args(PoissonDistribution(1))
def test_diofant__stats__drv_types__GeometricDistribution():
assert _test_args(GeometricDistribution(.5))
def test_diofant__core__symbol__BaseSymbol():
pass
def test_diofant__core__symbol__Dummy():
assert _test_args(Dummy('t'))
def test_diofant__core__symbol__Symbol():
assert _test_args(Symbol('t'))
def test_diofant__core__symbol__Wild():
assert _test_args(Wild('x', exclude=[x]))
def test_diofant__functions__combinatorial__factorials__CombinatorialFunction():
pass
def test_diofant__functions__combinatorial__factorials__FallingFactorial():
assert _test_args(FallingFactorial(2, x))
def test_diofant__functions__combinatorial__factorials__RisingFactorial():
assert _test_args(RisingFactorial(2, x))
def test_diofant__functions__combinatorial__factorials__binomial():
assert _test_args(binomial(2, x))
def test_diofant__functions__combinatorial__factorials__subfactorial():
assert _test_args(subfactorial(1))
def test_diofant__functions__combinatorial__factorials__factorial():
assert _test_args(factorial(x))
def test_diofant__functions__combinatorial__factorials__factorial2():
assert _test_args(factorial2(x))
def test_diofant__functions__combinatorial__numbers__bell():
assert _test_args(bell(x, y))
def test_diofant__functions__combinatorial__numbers__bernoulli():
assert _test_args(bernoulli(x))
def test_diofant__functions__combinatorial__numbers__catalan():
assert _test_args(catalan(x))
def test_diofant__functions__combinatorial__numbers__genocchi():
assert _test_args(genocchi(x))
def test_diofant__functions__combinatorial__numbers__euler():
assert _test_args(euler(x))
def test_diofant__functions__combinatorial__numbers__fibonacci():
assert _test_args(fibonacci(x))
def test_diofant__functions__combinatorial__numbers__harmonic():
assert _test_args(harmonic(x, 2))
def test_diofant__functions__combinatorial__numbers__lucas():
assert _test_args(lucas(x))
def test_diofant__functions__elementary__complexes__Abs():
assert _test_args(abs(x))
def test_diofant__functions__elementary__complexes__adjoint():
assert _test_args(adjoint(x))
def test_diofant__functions__elementary__complexes__arg():
assert _test_args(arg(x))
def test_diofant__functions__elementary__complexes__conjugate():
assert _test_args(conjugate(x))
def test_diofant__functions__elementary__complexes__im():
assert _test_args(im(x))
def test_diofant__functions__elementary__complexes__re():
assert _test_args(_re(x))
def test_diofant__functions__elementary__complexes__sign():