-
Notifications
You must be signed in to change notification settings - Fork 1
/
tabtools.tests.py
executable file
·1019 lines (1010 loc) · 36.6 KB
/
tabtools.tests.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
#! /usr/bin/env python3
__copyright__ = "(C) 2022-2024 Guido Draheim, licensed under the Apache License 2.0"""
__version__ = "1.1.3361"
from tabtools import *
import sys
import os
import unittest
import logging
from fnmatch import fnmatchcase as fnmatch
logg = logging.getLogger("TEST")
X1 = chr(norm_frac_1_4)
X2 = chr(norm_frac_1_2)
X3 = chr(norm_frac_3_4)
Q1 = chr(norm_frac_1_5)
Q2 = chr(norm_frac_2_5)
Q3 = chr(norm_frac_3_5)
Q4 = chr(norm_frac_4_5)
R1 = chr(norm_frac_1_6)
R2 = chr(norm_frac_1_3)
R3 = chr(norm_frac_1_2)
R4 = chr(norm_frac_2_3)
R5 = chr(norm_frac_5_6)
USD = chr(currency_dollar)
EUR = chr(currency_euro)
YEN = chr(currency_yen)
BPD = chr(currency_pound)
CUR = chr(currency_symbol)
K = 1024
M = 1024 * 1024
def rep(val: str) -> str:
val = val.replace("1/4", X1).replace("1/2", X2).replace("3/4", X3)
val = val.replace("1/5", Q1).replace("2/5", Q2).replace("3/5", Q3)
val = val.replace("4/5", Q4).replace("1/6", R1).replace("2/6", R2)
val = val.replace("3/6", R3).replace("4/6", R4).replace("5/6", R5)
val = val.replace("1/3", R2).replace("2/3", R4)
val = val.replace("EUR", EUR).replace("CUR", CUR)
val = val.replace("YEN", YEN).replace("BPD", BPD)
return val
class zeit2jiraTest(unittest.TestCase):
def test_100(self) -> None:
numm = Frac4(0)
data = "{:H}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0:00")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.0)
def test_101(self) -> None:
numm = Frac4(0.25)
data = "{:H}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0:15")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.25)
def test_102(self) -> None:
numm = Frac4(0.50)
data = "{:H}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0:30")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.50)
def test_103(self) -> None:
numm = Frac4(0.75)
data = "{:H}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0:45")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.75)
def test_104(self) -> None:
numm = Frac4(0.99)
data = "{:H}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1:00")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 1.0)
def test_110(self) -> None:
numm = Frac4(1)
data = "{:H}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1:00")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 1.0)
def test_111(self) -> None:
numm = Frac4(1.25)
data = "{:H}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1:15")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 1.25)
def test_112(self) -> None:
numm = Frac4(1.50)
data = "{:H}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1:30")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 1.50)
def test_113(self) -> None:
numm = Frac4(1.75)
data = "{:H}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1:45")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 1.75)
def test_114(self) -> None:
numm = Frac4(1.99)
data = "{:H}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("2:00")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 2)
def test_120(self) -> None:
numm = Frac4(12)
data = "{:H}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("12:00")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 12)
def test_121(self) -> None:
numm = Frac4(12.25)
data = "{:H}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("12:15")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 12.25)
def test_122(self) -> None:
numm = Frac4(12.50)
data = "{:H}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("12:30")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 12.50)
def test_123(self) -> None:
numm = Frac4(12.75)
data = "{:H}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("12:45")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 12.75)
def test_124(self) -> None:
numm = Frac4(12.99)
data = "{:H}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("13:00")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 13.00)
def test_173(self) -> None:
numm = Frac4(12.75)
data = "{:04H}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0012:45")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 12.75)
# ..............................
def test_200(self) -> None:
numm = Frac4(0)
data = "{:h}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0h")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.0)
def test_201(self) -> None:
numm = Frac4(0.25)
data = "{:h}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1/4h")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.25)
def test_202(self) -> None:
numm = Frac4(0.50)
data = "{:h}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1/2h")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.50)
def test_203(self) -> None:
numm = Frac4(0.75)
data = "{:h}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("3/4h")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.75)
def test_204(self) -> None:
numm = Frac4(0.9)
data = "{:h}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1h")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 1.0)
def test_210(self) -> None:
numm = Frac4(1)
data = "{:h}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1h")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 1.0)
def test_211(self) -> None:
numm = Frac4(1.25)
data = "{:h}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("11/4")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 1.25)
def test_212(self) -> None:
numm = Frac4(1.50)
data = "{:h}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("11/2")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 1.50)
def test_213(self) -> None:
numm = Frac4(1.75)
data = "{:h}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("13/4")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 1.75)
def test_214(self) -> None:
numm = Frac4(1.9)
data = "{:h}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("2h")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 2)
def test_220(self) -> None:
numm = Frac4(12)
data = "{:h}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("12h")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 12)
def test_221(self) -> None:
numm = Frac4(12.25)
data = "{:h}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("121/4")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 12.25)
def test_222(self) -> None:
numm = Frac4(12.50)
data = "{:h}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("121/2")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 12.50)
def test_223(self) -> None:
numm = Frac4(12.75)
data = "{:h}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("123/4")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 12.75)
def test_224(self) -> None:
numm = Frac4(12.9)
data = "{:h}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("13h")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 13.00)
def test_273(self) -> None:
numm = Frac4(12.75)
data = "{:04h}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("00123/4")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 12.75)
# ..............................
def test_300(self) -> None:
numm = Frac4(0)
data = "{:q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0)
def test_301(self) -> None:
numm = Frac4(0.25)
data = "{:q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1/4")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.25)
def test_302(self) -> None:
numm = Frac4(0.50)
data = "{:q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1/2")
self.assertEqual(want, data)
def test_303(self) -> None:
numm = Frac4(0.75)
data = "{:q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("3/4")
self.assertEqual(want, data)
def test_304(self) -> None:
numm = Frac4(0.9)
data = "{:q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1.")
self.assertEqual(want, data)
def test_310(self) -> None:
numm = Frac4(1)
data = "{:q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1.")
self.assertEqual(want, data)
def test_311(self) -> None:
numm = Frac4(1.25)
data = "{:q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("11/4")
self.assertEqual(want, data)
def test_312(self) -> None:
numm = Frac4(1.50)
data = "{:q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("11/2")
self.assertEqual(want, data)
def test_313(self) -> None:
numm = Frac4(1.75)
data = "{:q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("13/4")
self.assertEqual(want, data)
def test_314(self) -> None:
numm = Frac4(1.9)
data = "{:q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("2.")
self.assertEqual(want, data)
def test_320(self) -> None:
numm = Frac4(12)
data = "{:q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("12.")
self.assertEqual(want, data)
def test_321(self) -> None:
numm = Frac4(12.25)
data = "{:q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("121/4")
self.assertEqual(want, data)
def test_322(self) -> None:
numm = Frac4(12.50)
data = "{:q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("121/2")
self.assertEqual(want, data)
def test_323(self) -> None:
numm = Frac4(12.75)
data = "{:q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("123/4")
self.assertEqual(want, data)
def test_324(self) -> None:
numm = Frac4(12.9)
data = "{:q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("13.")
self.assertEqual(want, data)
def test_373(self) -> None:
numm = Frac4(12.75)
data = "{:04q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("00123/4")
self.assertEqual(want, data)
# ..............................
def test_400(self) -> None:
numm = Frac4(0)
data = "{:M}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0M")
self.assertEqual(want, data)
def test_401(self) -> None:
numm = Frac4(0.25 * M)
data = "{:M}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1/4M")
self.assertEqual(want, data)
def test_402(self) -> None:
numm = Frac4(0.50 * M)
data = "{:M}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1/2M")
self.assertEqual(want, data)
def test_403(self) -> None:
numm = Frac4(0.75 * M)
data = "{:M}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("3/4M")
self.assertEqual(want, data)
def test_404(self) -> None:
numm = Frac4(0.9 * M)
data = "{:M}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1.M")
self.assertEqual(want, data)
def test_410(self) -> None:
numm = Frac4(1 * M)
data = "{:M}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1.M")
self.assertEqual(want, data)
def test_411(self) -> None:
numm = Frac4(1.25 * M)
data = "{:M}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("11/4M")
self.assertEqual(want, data)
def test_412(self) -> None:
numm = Frac4(1.50 * M)
data = "{:M}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("11/2M")
self.assertEqual(want, data)
def test_413(self) -> None:
numm = Frac4(1.75 * M)
data = "{:M}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("13/4M")
self.assertEqual(want, data)
def test_414(self) -> None:
numm = Frac4(1.9 * M)
data = "{:M}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("2.M")
self.assertEqual(want, data)
def test_420(self) -> None:
numm = Frac4(12 * M)
data = "{:M}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("12.M")
self.assertEqual(want, data)
def test_421(self) -> None:
numm = Frac4(12.25 * M)
data = "{:M}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("121/4M")
self.assertEqual(want, data)
def test_422(self) -> None:
numm = Frac4(12.50 * M)
data = "{:M}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("121/2M")
self.assertEqual(want, data)
def test_423(self) -> None:
numm = Frac4(12.75 * M)
data = "{:M}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("123/4M")
self.assertEqual(want, data)
def test_424(self) -> None:
numm = Frac4(12.9 * M)
data = "{:M}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("13.M")
self.assertEqual(want, data)
def test_473(self) -> None:
numm = Frac4(12.75 * M)
data = "{:04M}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("00123/4M")
self.assertEqual(want, data)
# ..............................
def test_500(self) -> None:
numm = Frac4(0)
data = "{:Q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0")
self.assertEqual(want, data)
def test_501(self) -> None:
numm = Frac4(0.2)
data = "{:Q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1/5")
self.assertEqual(want, data)
def test_502(self) -> None:
numm = Frac4(0.4)
data = "{:Q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("2/5")
self.assertEqual(want, data)
def test_503(self) -> None:
numm = Frac4(0.6)
data = "{:Q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("3/5")
self.assertEqual(want, data)
def test_504(self) -> None:
numm = Frac4(0.8)
data = "{:Q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("4/5")
self.assertEqual(want, data)
def test_505(self) -> None:
numm = Frac4(0.9)
data = "{:Q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1.")
self.assertEqual(want, data)
def test_510(self) -> None:
numm = Frac4(1)
data = "{:Q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1.")
self.assertEqual(want, data)
def test_511(self) -> None:
numm = Frac4(1.2)
data = "{:Q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("11/5")
self.assertEqual(want, data)
def test_512(self) -> None:
numm = Frac4(1.4)
data = "{:Q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("12/5")
self.assertEqual(want, data)
def test_513(self) -> None:
numm = Frac4(1.6)
data = "{:Q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("13/5")
self.assertEqual(want, data)
def test_514(self) -> None:
numm = Frac4(1.8)
data = "{:Q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("14/5")
self.assertEqual(want, data)
def test_515(self) -> None:
numm = Frac4(1.9)
data = "{:Q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("2.")
self.assertEqual(want, data)
def test_520(self) -> None:
numm = Frac4(12)
data = "{:Q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("12.")
self.assertEqual(want, data)
def test_521(self) -> None:
numm = Frac4(12.2)
data = "{:Q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("121/5")
self.assertEqual(want, data)
def test_522(self) -> None:
numm = Frac4(12.4)
data = "{:Q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("122/5")
self.assertEqual(want, data)
def test_523(self) -> None:
numm = Frac4(12.6)
data = "{:Q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("123/5")
self.assertEqual(want, data)
def test_524(self) -> None:
numm = Frac4(12.8)
data = "{:Q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("124/5")
self.assertEqual(want, data)
def test_525(self) -> None:
numm = Frac4(12.9)
data = "{:Q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("13.")
self.assertEqual(want, data)
def test_573(self) -> None:
numm = Frac4(12.6)
data = "{:04Q}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("00123/5")
self.assertEqual(want, data)
# ..............................
def test_600(self) -> None:
numm = Frac4(0)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0")
self.assertEqual(want, data)
def test_601(self) -> None:
numm = Frac4(0.15)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1/6")
self.assertEqual(want, data)
def test_602(self) -> None:
numm = Frac4(0.3)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1/3")
self.assertEqual(want, data)
def test_603(self) -> None:
numm = Frac4(0.5)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1/2")
self.assertEqual(want, data)
def test_604(self) -> None:
numm = Frac4(0.65)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("2/3")
self.assertEqual(want, data)
def test_605(self) -> None:
numm = Frac4(0.8)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("5/6")
self.assertEqual(want, data)
def test_606(self) -> None:
numm = Frac4(0.95)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1.")
self.assertEqual(want, data)
def test_610(self) -> None:
numm = Frac4(1)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("1.")
self.assertEqual(want, data)
def test_611(self) -> None:
numm = Frac4(1.15)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("11/6")
self.assertEqual(want, data)
def test_612(self) -> None:
numm = Frac4(1.3)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("11/3")
self.assertEqual(want, data)
def test_613(self) -> None:
numm = Frac4(1.5)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("11/2")
self.assertEqual(want, data)
def test_614(self) -> None:
numm = Frac4(1.65)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("12/3")
self.assertEqual(want, data)
def test_615(self) -> None:
numm = Frac4(1.8)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("15/6")
self.assertEqual(want, data)
def test_616(self) -> None:
numm = Frac4(1.95)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("2.")
self.assertEqual(want, data)
def test_620(self) -> None:
numm = Frac4(12)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("12.")
self.assertEqual(want, data)
def test_621(self) -> None:
numm = Frac4(12.15)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("121/6")
self.assertEqual(want, data)
def test_622(self) -> None:
numm = Frac4(12.3)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("121/3")
self.assertEqual(want, data)
def test_623(self) -> None:
numm = Frac4(12.5)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("121/2")
self.assertEqual(want, data)
def test_624(self) -> None:
numm = Frac4(12.65)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("122/3")
self.assertEqual(want, data)
def test_625(self) -> None:
numm = Frac4(12.8)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("125/6")
self.assertEqual(want, data)
def test_626(self) -> None:
numm = Frac4(12.95)
data = "{:R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("13.")
self.assertEqual(want, data)
def test_673(self) -> None:
numm = Frac4(12.5)
data = "{:04R}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("00121/2")
self.assertEqual(want, data)
# ..............................
def test_900(self) -> None:
numm = Frac4(0)
data = "{:$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.00EUR")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.00)
def test_901(self) -> None:
numm = Frac4(0.25)
data = "{:$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.25EUR")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.25)
def test_902(self) -> None:
numm = Frac4(0.50)
data = "{:$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.50EUR")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.50)
def test_903(self) -> None:
numm = Frac4(0.6666)
data = "{:$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.66EUR")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.66)
def test_910(self) -> None:
numm = Frac4(0)
data = "{:US$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.00$")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.00)
def test_911(self) -> None:
numm = Frac4(0.25)
data = "{:US$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.25$")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.25)
def test_912(self) -> None:
numm = Frac4(0.50)
data = "{:US$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.50$")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.50)
def test_913(self) -> None:
numm = Frac4(0.6666)
data = "{:US$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.66$")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.66)
def test_930(self) -> None:
numm = Frac4(0)
data = "{:EU$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.00EUR")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.00)
def test_931(self) -> None:
numm = Frac4(0.25)
data = "{:EU$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.25EUR")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.25)
def test_932(self) -> None:
numm = Frac4(0.50)
data = "{:EU$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.50EUR")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.50)
def test_933(self) -> None:
numm = Frac4(0.6666)
data = "{:EU$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.66EUR")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.66)
def test_940(self) -> None:
numm = Frac4(0)
data = "{:EC$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.00EUR")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.00)
def test_941(self) -> None:
numm = Frac4(0.25)
data = "{:EC$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.25EUR")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.25)
def test_942(self) -> None:
numm = Frac4(0.50)
data = "{:EC$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.50EUR")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.50)
def test_943(self) -> None:
numm = Frac4(0.6666)
data = "{:EC$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.66EUR")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.66)
def test_950(self) -> None:
numm = Frac4(0)
data = "{:JP$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.00YEN")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.00)
def test_951(self) -> None:
numm = Frac4(0.25)
data = "{:JP$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.25YEN")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.25)
def test_952(self) -> None:
numm = Frac4(0.50)
data = "{:JP$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.50YEN")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.50)
def test_953(self) -> None:
numm = Frac4(0.6666)
data = "{:JP$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.66YEN")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.66)
def test_960(self) -> None:
numm = Frac4(0)
data = "{:CN$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.00YEN")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.00)
def test_961(self) -> None:
numm = Frac4(0.25)
data = "{:CN$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.25YEN")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.25)
def test_962(self) -> None:
numm = Frac4(0.50)
data = "{:CN$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.50YEN")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.50)
def test_963(self) -> None:
numm = Frac4(0.6666)
data = "{:CN$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.66YEN")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.66)
def test_970(self) -> None:
numm = Frac4(0)
data = "{:BP$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.00BPD")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0)
def test_971(self) -> None:
numm = Frac4(0.25)
data = "{:BP$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.25BPD")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.25)
def test_972(self) -> None:
numm = Frac4(0.50)
data = "{:BP$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.50BPD")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.50)
def test_973(self) -> None:
numm = Frac4(0.6666)
data = "{:BP$}".format(numm) # type: ignore[str-format]
logg.info("data = %s", data)
want = rep("0.66BPD")
self.assertEqual(want, data)
back = fracfloat(data)
self.assertEqual(back, 0.66)
if __name__ == "__main__":
# unittest.main()
from optparse import OptionParser
cmdline = OptionParser("%prog [t_]test...")
cmdline.add_option("-v", "--verbose", action="count", default=0, help="more verbose logging")
cmdline.add_option("-^", "--quiet", action="count", default=0, help="less verbose logging")
cmdline.add_option("--failfast", action="store_true", default=False,
help="Stop the test run on the first error or failure. [%default]")
cmdline.add_option("--xmlresults", metavar="FILE", default=None,
help="capture results as a junit xml file [%default]")
opt, args = cmdline.parse_args()
logging.basicConfig(level=max(0, logging.WARNING - 10 * opt.verbose + 10 * opt.quiet))
if not args:
args = ["test_*"]
suite = unittest.TestSuite()
for arg in args:
if len(arg) > 2 and arg[0].isalpha() and arg[1] == "_":
arg = "test_" + arg[2:]
for classname in sorted(globals()):
if not classname.endswith("Test"):
continue
testclass = globals()[classname]
for method in sorted(dir(testclass)):
if "*" not in arg: arg += "*"