-
Notifications
You must be signed in to change notification settings - Fork 142
/
Copy pathtest_26_emit.py
1270 lines (1125 loc) · 58.7 KB
/
test_26_emit.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
# Import required modules
import os
import sys
import tempfile
from _unittest_solvers.conftest import config
import pytest
from pyaedt import Emit
from pyaedt.emit_core.emit_constants import EmiCategoryFilter
from pyaedt.emit_core.emit_constants import InterfererType
from pyaedt.emit_core.emit_constants import ResultType
from pyaedt.emit_core.emit_constants import TxRxMode
from pyaedt.generic import constants as consts
from pyaedt.generic.general_methods import is_linux
from pyaedt.modeler.circuits.PrimitivesEmit import EmitAntennaComponent
from pyaedt.modeler.circuits.PrimitivesEmit import EmitComponent
from pyaedt.modeler.circuits.PrimitivesEmit import EmitComponents
TEST_SUBFOLDER = "T26"
TEST_REVIEW_FLAG = True
@pytest.fixture(scope="class")
def aedtapp(add_app):
app = add_app(application=Emit)
return app
@pytest.mark.skipif(is_linux, reason="Emit API fails on linux.")
@pytest.mark.skipif(sys.version_info < (3,8), reason="Emit API is only available for Python 3.8+.")
class TestClass:
@pytest.fixture(autouse=True)
def init(self, aedtapp, local_scratch):
self.aedtapp = aedtapp
self.local_scratch = local_scratch
def test_01_objects(self):
assert self.aedtapp.solution_type
assert isinstance(self.aedtapp.modeler.components, EmitComponents)
assert self.aedtapp.modeler
assert self.aedtapp.oanalysis is None
if self.aedtapp._aedt_version > "2023.1":
if sys.version_info.major == 3 and sys.version_info.minor == 7:
assert str(type(self.aedtapp._emit_api)) == "<class 'EmitApiPython.EmitApi'>"
assert self.aedtapp.results is not None
elif sys.version_info.major == 3 and sys.version_info.minor == 8:
assert str(type(self.aedtapp._emit_api)) == "<class 'EmitApiPython38.EmitApi'>"
assert self.aedtapp.results is not None
elif sys.version_info.major == 3 and sys.version_info.minor == 9:
assert str(type(self.aedtapp._emit_api)) == "<class 'EmitApiPython39.EmitApi'>"
assert self.aedtapp.results is not None
elif sys.version_info.major == 3 and sys.version_info.minor == 10:
assert str(type(self.aedtapp._emit_api)) == "<class 'EmitApiPython310.EmitApi'>"
assert self.aedtapp.results is not None
elif sys.version_info.major == 3 and sys.version_info.minor == 11:
assert str(type(self.aedtapp._emit_api)) == "<class 'EmitApiPython311.EmitApi'>"
assert self.aedtapp.results is not None
@pytest.mark.skipif(config["desktopVersion"] <= "2022.1", reason="Skipped on versions earlier than 2021.2")
def test_02_create_components(self, add_app):
self.aedtapp = add_app(application=Emit)
radio = self.aedtapp.modeler.components.create_component("New Radio", "TestRadio")
assert radio.name == "TestRadio"
assert radio.composed_name == "TestRadio"
assert isinstance(radio, EmitComponent)
antenna = self.aedtapp.modeler.components.create_component("Antenna", "TestAntenna")
assert antenna.name == "TestAntenna"
assert isinstance(antenna, EmitAntennaComponent)
emitter = self.aedtapp.modeler.components.create_component("New Emitter", "TestEmitter")
assert emitter.name == "TestEmitter"
assert isinstance(emitter, EmitComponent)
# add each component type
amplifier = self.aedtapp.modeler.components.create_component("Amplifier", "TestAmplifier")
assert amplifier.name == "TestAmplifier"
assert isinstance(amplifier, EmitComponent)
cable = self.aedtapp.modeler.components.create_component("Cable", "TestCable")
assert cable.name == "TestCable"
assert isinstance(cable, EmitComponent)
circulator = self.aedtapp.modeler.components.create_component("Circulator", "TestCirculator")
assert circulator.name == "TestCirculator"
assert isinstance(circulator, EmitComponent)
divider = self.aedtapp.modeler.components.create_component("Divider", "TestDivider")
assert divider.name == "TestDivider"
assert isinstance(divider, EmitComponent)
filter_bpf = self.aedtapp.modeler.components.create_component("Band Pass", "TestBPF")
assert filter_bpf.name == "TestBPF"
assert isinstance(filter_bpf, EmitComponent)
filter_bsf = self.aedtapp.modeler.components.create_component("Band Stop", "TestBSF")
assert filter_bsf.name == "TestBSF"
assert isinstance(filter_bsf, EmitComponent)
filter_file = self.aedtapp.modeler.components.create_component("File-based", "TestFilterByFile")
assert filter_file.name == "TestFilterByFile"
assert isinstance(filter_file, EmitComponent)
filter_hpf = self.aedtapp.modeler.components.create_component("High Pass", "TestHPF")
assert filter_hpf.name == "TestHPF"
assert isinstance(filter_hpf, EmitComponent)
filter_lpf = self.aedtapp.modeler.components.create_component("Low Pass", "TestLPF")
assert filter_lpf.name == "TestLPF"
assert isinstance(filter_lpf, EmitComponent)
filter_tbpf = self.aedtapp.modeler.components.create_component("Tunable Band Pass", "TestTBPF")
assert filter_tbpf.name == "TestTBPF"
assert isinstance(filter_tbpf, EmitComponent)
filter_tbsf = self.aedtapp.modeler.components.create_component("Tunable Band Stop", "TestTBSF")
assert filter_tbsf.name == "TestTBSF"
assert isinstance(filter_tbsf, EmitComponent)
isolator = self.aedtapp.modeler.components.create_component("Isolator", "TestIsolator")
assert isolator.name == "TestIsolator"
assert isinstance(isolator, EmitComponent)
mux3 = self.aedtapp.modeler.components.create_component("3 Port", "Test3port")
assert mux3.name == "Test3port"
assert isinstance(mux3, EmitComponent)
mux4 = self.aedtapp.modeler.components.create_component("4 Port", "Test4port")
assert mux4.name == "Test4port"
assert isinstance(mux4, EmitComponent)
mux5 = self.aedtapp.modeler.components.create_component("5 Port", "Test5port")
assert mux5.name == "Test5port"
assert isinstance(mux5, EmitComponent)
# Multiplexer 6 port added at 2023.2
if self.aedtapp._aedt_version > "2023.1":
mux6 = self.aedtapp.modeler.components.create_component("6 Port", "Test6port")
assert mux6.name == "Test6port"
assert isinstance(mux6, EmitComponent)
switch = self.aedtapp.modeler.components.create_component("TR Switch", "TestSwitch")
assert switch.name == "TestSwitch"
assert isinstance(switch, EmitComponent)
terminator = self.aedtapp.modeler.components.create_component("Terminator", "TestTerminator")
assert terminator.name == "TestTerminator"
assert isinstance(terminator, EmitComponent)
@pytest.mark.skipif(config["desktopVersion"] <= "2022.1", reason="Skipped on versions earlier than 2021.2")
def test_03_connect_components(self, add_app):
self.aedtapp = add_app(application=Emit)
radio = self.aedtapp.modeler.components.create_component("New Radio")
antenna = self.aedtapp.modeler.components.create_component("Antenna")
antenna.move_and_connect_to(radio)
antenna_port = antenna.port_names()[0] # antennas have 1 port
radio_port = radio.port_names()[0] # radios have 1 port
connected_comp, connected_port = antenna.port_connection(antenna_port)
assert connected_comp == radio.name
assert connected_port == radio_port
# Test get_connected_components()
connected_components_list = radio.get_connected_components()
assert antenna in connected_components_list
# Verify None,None is returned for an unconnected port
radio2 = self.aedtapp.modeler.components.create_component("New Radio")
radio2_port = radio2.port_names()[0]
connected_comp, connected_port = radio2.port_connection(radio2_port)
assert connected_comp is None
assert connected_port is None
# Test create_radio_antenna
radio3, antenna3 = self.aedtapp.modeler.components.create_radio_antenna("New Radio")
ant3_port = antenna3.port_names()[0]
rad3_port = radio3.port_names()[0]
connected_comp, connected_port = antenna3.port_connection(ant3_port)
assert connected_comp == radio3.name
assert connected_port == rad3_port
@pytest.mark.skipif(config["desktopVersion"] <= "2022.1", reason="Skipped on versions earlier than 2022 R2.")
def test_04_radio_component(self, add_app):
self.aedtapp = add_app(application=Emit)
radio = self.aedtapp.modeler.components.create_component("New Radio")
# default radio has 1 Tx channel and 1 Rx channel
assert radio.has_rx_channels()
assert radio.has_tx_channels()
# test band.enabled to confirm component properties can be get/set
assert len(radio.bands()) > 0
band = radio.bands()[0]
assert band.enabled
band.enabled = False
assert not band.enabled
# Try set band power from the radio
exception_raised = False
try:
radio.set_band_power_level(100)
except:
exception_raised = True
assert exception_raised
# Try getting band power from the radio
exception_raised = False
try:
radio.get_band_power_level()
except:
exception_raised = True
assert exception_raised
# full units support added with 2023.2
if self.aedtapp._aedt_version > "2023.1":
# test band.set_band_power_level
band.set_band_power_level(100)
power = band.get_band_power_level()
assert power == 100.0
# test band.set_band_power_level
band.set_band_power_level(10, "W")
power = band.get_band_power_level("mW")
assert power == 10000.0
# test frequency unit conversions
start_freq = radio.band_start_frequency(band)
assert start_freq == 100.0
start_freq = radio.band_start_frequency(band, "Hz")
assert start_freq == 100000000.0
start_freq = radio.band_start_frequency(band, "kHz")
assert start_freq == 100000.0
start_freq = radio.band_start_frequency(band, "GHz")
assert start_freq == 0.1
start_freq = radio.band_start_frequency(band, "THz")
assert start_freq == 0.0001
# test band.set_band_start_frequency
start_freq = 10
units = 'MHz'
radio.set_band_start_frequency(band, start_freq, units=units)
assert radio.band_start_frequency(band, units=units) == start_freq
start_freq = 20000000
radio.set_band_start_frequency(band, start_freq)
assert radio.band_start_frequency(band, units='Hz') == start_freq
# test band.set_band_stop_frequency
stop_freq = 30
units = 'MHz'
radio.set_band_stop_frequency(band, stop_freq, units=units)
assert radio.band_stop_frequency(band, units=units) == stop_freq
stop_freq = 40000000
radio.set_band_stop_frequency(band, stop_freq)
assert radio.band_stop_frequency(band, units='Hz') == stop_freq
# test corner cases for band start and stop frequencies
start_freq = 10
stop_freq = 9
units = 'Hz'
radio.set_band_start_frequency(band, start_freq, units=units)
radio.set_band_stop_frequency(band, stop_freq, units=units)
assert radio.band_start_frequency(band, units="Hz") == 8
radio.set_band_start_frequency(band, 10, units=units)
assert radio.band_stop_frequency(band, units="Hz") == 11
units = 'wrong'
radio.set_band_stop_frequency(band, 10, units=units)
assert radio.band_stop_frequency(band, units='Hz') == 10
radio.set_band_start_frequency(band, 10, units=units)
assert radio.band_start_frequency(band, units='Hz') == 10
with pytest.raises(ValueError) as e:
start_freq = 101
units = 'GHz'
radio.set_band_start_frequency(band, start_freq, units=units)
assert "Frequency should be within 1Hz to 100 GHz." in str(e)
stop_freq = 102
radio.set_band_stop_frequency(band, stop_freq, units=units)
assert "Frequency should be within 1Hz to 100 GHz." in str(e)
# test power unit conversions
band_power = radio.band_tx_power(band)
assert band_power == 40.0
band_power = radio.band_tx_power(band, "dBW")
assert band_power == 10.0
band_power = radio.band_tx_power(band, "mW")
assert band_power == 10000.0
band_power = radio.band_tx_power(band, "W")
assert band_power == 10.0
band_power = radio.band_tx_power(band, "kW")
assert band_power == 0.01
@pytest.mark.skipif(config["desktopVersion"] <= "2022.1", reason="Skipped on versions earlier than 2022 R2.")
def test_05_emit_power_conversion(self):
# Test power unit conversions (dBm to user_units)
powers = [10, 20, 30, 40, 50]
converted_powers = consts.unit_converter(powers, "Power", "dBm", "dBm")
assert converted_powers == powers
converted_powers = consts.unit_converter(powers, "Power", "dBm", "dBW")
assert converted_powers == [-20, -10, 0, 10, 20]
converted_powers = consts.unit_converter(powers, "Power", "dBm", "mW")
assert converted_powers == [10, 100, 1000, 10000, 100000]
converted_powers = consts.unit_converter(powers, "Power", "dBm", "W")
assert converted_powers == [0.01, 0.1, 1, 10, 100]
converted_powers = consts.unit_converter(powers, "Power", "dBm", "kW")
assert converted_powers == [0.00001, 0.0001, 0.001, 0.01, 0.1]
# Test power conversions (user units to dBm)
powers = [0.00001, 0.0001, 0.001, 0.01, 0.1]
converted_powers = consts.unit_converter(powers, "Power", "kW", "dBm")
assert converted_powers == [10, 20, 30, 40, 50]
powers = [0.01, 0.1, 1, 10, 100]
converted_powers = consts.unit_converter(powers, "Power", "W", "dBm")
assert converted_powers == [10, 20, 30, 40, 50]
powers = [10, 100, 1000, 10000, 100000]
converted_powers = consts.unit_converter(powers, "Power", "mW", "dBm")
assert converted_powers == [10, 20, 30, 40, 50]
powers = [-20, -10, 0, 10, 20]
converted_powers = consts.unit_converter(powers, "Power", "dBW", "dBm")
assert converted_powers == [10, 20, 30, 40, 50]
powers = [10, 20, 30, 40, 50]
converted_powers = consts.unit_converter(powers, "Power", "dBm", "dBm")
assert converted_powers == [10, 20, 30, 40, 50]
power = 10
converted_power = consts.unit_converter(power, "Power", "dBW", "dBm")
assert converted_power == 40
power = 10
converted_power = consts.unit_converter(power, "Power", "mW", "dBm")
assert converted_power == 10
power = 0.1
converted_power = consts.unit_converter(power, "Power", "kW", "dBm")
assert converted_power == 50
# Test bad units
power = 10
bad_units = consts.unit_converter(power, "Power", "dbw", "dBm")
assert bad_units == power
power = 30
bad_units = consts.unit_converter(power, "Power", "w", "dBm")
assert bad_units == power
@pytest.mark.skipif(config["desktopVersion"] <= "2023.1", reason="Skipped on versions earlier than 2023 R2.")
def test_06_units_getters(self, add_app):
self.aedtapp = add_app(application=Emit)
# Set a single unit
valid = self.aedtapp.set_units("Frequency", "Hz")
units = self.aedtapp.get_units("Frequency")
assert valid
assert units == "Hz"
# Test bad unit input
units = self.aedtapp.get_units("Bad units")
assert units == None
valid = self.aedtapp.set_units("Bad units", "Hz")
assert valid is False
valid = self.aedtapp.set_units("Frequency", "hertz")
assert valid is False
# Set a list of units
unit_system = ["Power", "Frequency", "Length", "Time", "Voltage", "Data Rate", "Resistance"]
units = ["mW", "GHz", "nm", "ps", "mV", "Gbps", "uOhm"]
valid = self.aedtapp.set_units(unit_system, units)
updated_units = self.aedtapp.get_units()
assert valid
assert updated_units == {
"Power": "mW",
"Frequency": "GHz",
"Length": "nm",
"Time": "ps",
"Voltage": "mV",
"Data Rate": "Gbps",
"Resistance": "uOhm",
}
# Set a bad list of units
unit_system = ["Por", "Frequency", "Length", "Time", "Voltage", "Data Rate", "Resistance"]
units = ["mW", "GHz", "nm", "ps", "mV", "Gbps", "uOhm"]
valid = self.aedtapp.set_units(unit_system, units)
assert valid is False
unit_system = ["Power", "Frequency", "Length", "Time", "Voltage", "Data Rate", "Resistance"]
units = ["mW", "f", "nm", "ps", "mV", "Gbps", "uOhm"]
valid = self.aedtapp.set_units(unit_system, units)
assert valid is False
@pytest.mark.skipif(config["desktopVersion"] <= "2023.1", reason="Skipped on versions earlier than 2023 R2.")
def test_07_antenna_component(self, add_app):
self.aedtapp = add_app(application=Emit)
antenna = self.aedtapp.modeler.components.create_component("Antenna")
# Default pattern filename is empty string
pattern_filename = antenna.get_pattern_filename()
assert pattern_filename == ""
# Default orientation is 0 0 0
orientation = antenna.get_orientation_rpy()
assert orientation == (0.0, 0.0, 0.0)
# Default position is 0 0 0
position = antenna.get_position()
assert position == (0.0, 0.0, 0.0)
@pytest.mark.skipif(
config["desktopVersion"] <= "2023.1",
reason="Skipped on versions earlier than 2023.2",
)
def test_08_revision_generation(self, add_app):
self.aedtapp = add_app(application=Emit)
assert len(self.aedtapp.results.revisions) == 0
# place components and generate the appropriate number of revisions
rad1 = self.aedtapp.modeler.components.create_component("UE - Handheld")
ant1 = self.aedtapp.modeler.components.create_component("Antenna")
ant1.move_and_connect_to(rad1)
rad2 = self.aedtapp.modeler.components.create_component("Bluetooth")
ant2 = self.aedtapp.modeler.components.create_component("Antenna")
ant2.move_and_connect_to(rad2)
rad3 = self.aedtapp.modeler.components.create_component("Bluetooth")
ant3 = self.aedtapp.modeler.components.create_component("Antenna")
ant3.move_and_connect_to(rad3)
rev = self.aedtapp.results.analyze()
assert len(self.aedtapp.results.revisions) == 1
assert rev.name == "Revision 10"
assert rev.revision_number == 10
rev_timestamp = rev.timestamp
assert rev_timestamp
self.aedtapp.results.analyze()
assert len(self.aedtapp.results.revisions) == 1
rad4 = self.aedtapp.modeler.components.create_component("Bluetooth")
ant4 = self.aedtapp.modeler.components.create_component("Antenna")
ant4.move_and_connect_to(rad4)
rev2 = self.aedtapp.results.analyze()
assert len(self.aedtapp.results.revisions) == 2
rad5 = self.aedtapp.modeler.components.create_component("HAVEQUICK Airborne")
ant5 = self.aedtapp.modeler.components.create_component("Antenna")
ant4.move_and_connect_to(rad5)
assert len(self.aedtapp.results.revisions) == 2
# validate notes can be get/set
rev2.notes = "Added Bluetooth and an antenna"
notes = rev2.notes
assert rev2.name == "Revision 13"
assert notes == "Added Bluetooth and an antenna"
# get the initial revision
rev3 = self.aedtapp.results.get_revision("Revision 10")
assert rev3.name == "Revision 10"
assert rev3.revision_number == 10
assert rev_timestamp == rev3.timestamp
# test result_mode_error(), try to access unloaded revision
receivers = rev2.get_receiver_names()
assert receivers is None
transmitters = rev2.get_interferer_names()
assert transmitters is None
bands = rev2.get_band_names(rad5)
assert bands is None
freqs = rev2.get_active_frequencies(rad5, "Band", TxRxMode.TX)
assert freqs is None
# get the most recent revision
# there are changes, so it should be a new revision
rev4 = self.aedtapp.results.analyze()
assert rev4.name == "Revision 16"
# get the initial revision
rev5 = self.aedtapp.results.get_revision("Revision 10")
assert rev5.name == "Revision 10"
# get the most recent revision
# no changes, so it should be the most recent revision
rev6 = self.aedtapp.results.analyze()
assert rev6.name == "Revision 16"
@pytest.mark.skipif(
config["desktopVersion"] <= "2023.1",
reason="Skipped on versions earlier than 2023.2",
)
def test_09_manual_revision_access_test_getters(self, add_app):
self.aedtapp = add_app(application=Emit)
rad1 = self.aedtapp.modeler.components.create_component("UE - Handheld")
ant1 = self.aedtapp.modeler.components.create_component("Antenna")
rad2 = self.aedtapp.modeler.components.create_component("Bluetooth")
ant1.move_and_connect_to(rad1)
ant2 = self.aedtapp.modeler.components.create_component("Antenna")
ant2.move_and_connect_to(rad2)
rad3 = self.aedtapp.modeler.components.create_component("Bluetooth")
ant3 = self.aedtapp.modeler.components.create_component("Antenna")
ant3.move_and_connect_to(rad3)
# Change the sampling
modeRx = TxRxMode.RX
sampling = rad3.get_sampling()
assert sampling.node_name == "NODE-*-RF Systems-*-RF System-*-Radios-*-Bluetooth-*-Sampling"
sampling.set_channel_sampling(percentage=25)
rev = self.aedtapp.results.analyze()
radiosRX = rev.get_receiver_names()
assert radiosRX[0] == "Bluetooth"
assert radiosRX[1] == "Bluetooth 2"
bandsRX = rev.get_band_names(radiosRX[0], modeRx)
assert bandsRX[0] == "Rx - Base Data Rate"
assert bandsRX[1] == "Rx - Enhanced Data Rate"
rx_frequencies = rev.get_active_frequencies(radiosRX[0], bandsRX[0], modeRx)
assert rx_frequencies[0] == 2402.0
assert rx_frequencies[1] == 2403.0
# Change the units globally
self.aedtapp.set_units("Frequency", "GHz")
rx_frequencies = rev.get_active_frequencies(radiosRX[0], bandsRX[0], modeRx)
assert rx_frequencies[0] == 2.402
assert rx_frequencies[1] == 2.403
# Change the return units only
rx_frequencies = rev.get_active_frequencies(radiosRX[0], bandsRX[0], modeRx, "Hz")
assert rx_frequencies[0] == 2402000000.0
assert rx_frequencies[1] == 2403000000.0
# Test set_sampling
bandsRX = rev.get_band_names(radiosRX[1], modeRx)
rx_frequencies = rev.get_active_frequencies(radiosRX[1], bandsRX[0], modeRx)
assert len(rx_frequencies) == 20
sampling.set_channel_sampling(max_channels=10)
rev2 = self.aedtapp.results.analyze()
rx_frequencies = rev2.get_active_frequencies(radiosRX[1], bandsRX[0], modeRx)
assert len(rx_frequencies) == 10
sampling.set_channel_sampling("Random", max_channels=75)
rev3 = self.aedtapp.results.analyze()
rx_frequencies = rev3.get_active_frequencies(radiosRX[1], bandsRX[0], modeRx)
assert len(rx_frequencies) == 75
assert rx_frequencies[0] == 2.402
assert rx_frequencies[1] == 2.403
sampling.set_channel_sampling("Random", percentage=25, seed=100)
rev4 = self.aedtapp.results.analyze()
rx_frequencies = rev4.get_active_frequencies(radiosRX[1], bandsRX[0], modeRx)
assert len(rx_frequencies) == 19
assert rx_frequencies[0] == 2.402
assert rx_frequencies[1] == 2.411
sampling.set_channel_sampling("all")
rev5 = self.aedtapp.results.analyze()
rx_frequencies = rev5.get_active_frequencies(radiosRX[1], bandsRX[0], modeRx)
assert len(rx_frequencies) == 79
@pytest.mark.skipif(
config["desktopVersion"] <= "2023.1",
reason="Skipped on versions earlier than 2023.2",
)
def test_10_radio_band_getters(self, add_app):
self.aedtapp = add_app(application=Emit)
rad1, ant1 = self.aedtapp.modeler.components.create_radio_antenna("New Radio")
rad2, ant2 = self.aedtapp.modeler.components.create_radio_antenna("Bluetooth Low Energy (LE)")
rad3, ant3 = self.aedtapp.modeler.components.create_radio_antenna("WiFi - 802.11-2012")
rad4, ant4 = self.aedtapp.modeler.components.create_radio_antenna("WiFi 6")
# Check type
rad_type = rad1.get_type()
assert rad_type == "RadioNode"
ant_type = ant1.get_type()
assert ant_type == "AntennaNode"
# Check antenna connections
ants = rad1.get_connected_antennas()
assert ants[0].name == "Antenna"
ants = rad2.get_connected_antennas()
assert ants[0].name == "Antenna 2"
# Set all Bands for WiFi radios, enabled
band_nodes = rad3.bands()
for bn in band_nodes:
bn.enabled = True
band_nodes = rad4.bands()
for bn in band_nodes:
bn.enabled = True
band_node = rad4.band_node("Invalid")
assert band_node is None
band_node = rad4.band_node("U-NII-5-8 QPSK R=0.75 (Bw 80 MHz)")
assert band_node.enabled
# Set up the results
rev = self.aedtapp.results.analyze()
# Get Tx Radios
radios = rev.get_interferer_names()
assert radios == ["Radio", "Bluetooth Low Energy (LE)", "WiFi - 802.11-2012", "WiFi 6"]
# Get the Bands
bands = rev.get_band_names(radios[0], TxRxMode.RX)
assert bands == ["Band"]
# Get the Freqs
freqs = rev.get_active_frequencies(radios[0], bands[0], TxRxMode.RX, "MHz")
assert freqs == [100.0]
# Test error for trying to get BOTH tx and rx freqs
exception_raised = False
try:
freqs = rev.get_active_frequencies(radios[0], bands[0], TxRxMode.BOTH, "MHz")
except:
exception_raised = True
assert exception_raised
# Get WiFi 2012 Rx Bands
bands = rev.get_band_names(radios[2], TxRxMode.RX)
assert len(bands) == 16
# Get WiFi 2012 Tx Bands
bands = rev.get_band_names(radios[2], TxRxMode.TX)
assert len(bands) == 16
# Get WiFi 2012 All Bands
bands = rev.get_band_names(radios[2], TxRxMode.BOTH)
assert len(bands) == 32
# Get WiFi 2012 All Bands (default args)
bands = rev.get_band_names(radios[2])
assert len(bands) == 32
# Get WiFi 6 All Bands (default args)
bands = rev.get_band_names(radios[3])
assert len(bands) == 192
# Get WiFi 6 Rx Bands
bands = rev.get_band_names(radios[3], TxRxMode.RX)
assert len(bands) == 192
# Get WiFi 6 Tx Bands
bands = rev.get_band_names(radios[3], TxRxMode.TX)
assert len(bands) == 192
# Get WiFi 6 All Bands
bands = rev.get_band_names(radios[3], TxRxMode.BOTH)
assert len(bands) == 192
# Add an emitter
emitter1 = self.aedtapp.modeler.components.create_component("USB_3.x")
rev2 = self.aedtapp.results.analyze()
# Get emitters only
emitters = rev2.get_interferer_names(InterfererType.EMITTERS)
assert emitters == ["USB_3.x"]
# Get transmitters only
transmitters = rev2.get_interferer_names(InterfererType.TRANSMITTERS)
assert transmitters == ["Radio", "Bluetooth Low Energy (LE)", "WiFi - 802.11-2012", "WiFi 6"]
# Get all interferers
all_ix = rev2.get_interferer_names(InterfererType.TRANSMITTERS_AND_EMITTERS)
assert all_ix == ["Radio", "Bluetooth Low Energy (LE)", "WiFi - 802.11-2012", "WiFi 6", "USB_3.x"]
@pytest.mark.skipif(config["desktopVersion"] <= "2022.1", reason="Skipped on versions earlier than 2021.2")
def test_11_sampling_getters(self, add_app):
self.aedtapp = add_app(application=Emit)
rad, ant = self.aedtapp.modeler.components.create_radio_antenna("New Radio")
# Check type
rad_type = rad.get_type()
assert rad_type == "RadioNode"
ant_type = ant.get_type()
assert ant_type == "AntennaNode"
# Check sampling
exception_raised = False
try:
rad.set_channel_sampling()
except:
exception_raised = True
assert exception_raised
# Get sampling node
sampling = rad.get_sampling()
assert sampling.node_name == "NODE-*-RF Systems-*-RF System-*-Radios-*-Radio-*-Sampling"
# Test sampling params
sampling.set_channel_sampling("All")
assert sampling.props["SamplingType"] == "SampleAllChannels"
sampling.set_channel_sampling("Uniform", percentage=25)
assert sampling.props["SamplingType"] == "UniformSampling"
assert sampling.props["SpecifyPercentage"] == "true"
assert sampling.props["PercentageChannels"] == "25"
sampling.set_channel_sampling("Uniform", max_channels=50)
assert sampling.props["SamplingType"] == "UniformSampling"
assert sampling.props["SpecifyPercentage"] == "false"
assert sampling.props["NumberChannels"] == "50"
sampling.set_channel_sampling("Random", percentage=33)
assert sampling.props["SamplingType"] == "RandomSampling"
assert sampling.props["SpecifyPercentage"] == "true"
assert sampling.props["PercentageChannels"] == "33"
assert sampling.props["RandomSeed"] == "0"
sampling.set_channel_sampling("Random", max_channels=75, seed=37)
assert sampling.props["SamplingType"] == "RandomSampling"
assert sampling.props["SpecifyPercentage"] == "false"
assert sampling.props["NumberChannels"] == "75"
assert sampling.props["RandomSeed"] == "37"
sampling.set_channel_sampling("Uniform")
assert sampling.props["SamplingType"] == "UniformSampling"
assert sampling.props["SpecifyPercentage"] == "false"
assert sampling.props["NumberChannels"] == "1000"
@pytest.mark.skipif(config["desktopVersion"] <= "2022.1", reason="Skipped on versions earlier than 2021.2")
def test_12_radio_getters(self, add_app):
self.aedtapp = add_app(application=Emit)
rad, ant = self.aedtapp.modeler.components.create_radio_antenna("New Radio")
rad2, ant2 = self.aedtapp.modeler.components.create_radio_antenna("Bluetooth")
emitter = self.aedtapp.modeler.components.create_component("USB_3.x")
# get the radio nodes
radios = self.aedtapp.modeler.components.get_radios()
assert radios[rad.name] == rad
assert radios[rad2.name] == rad2
assert radios[emitter.name] == emitter
# validate is_emitter function
assert not rad.is_emitter()
assert not rad2.is_emitter()
assert emitter.is_emitter()
@pytest.mark.skipif(
config["desktopVersion"] <= "2023.1",
reason="Skipped on versions earlier than 2023.2",
)
def test_13_static_type_generation(self):
domain = self.aedtapp.results.interaction_domain()
if sys.version_info < (3, 8):
py_version = "EmitApiPython"
elif sys.version_info < (3, 9):
py_version = "EmitApiPython38"
elif sys.version_info < (3, 10):
py_version = "EmitApiPython39"
elif sys.version_info < (3, 11):
py_version = "EmitApiPython310"
elif sys.version_info < (3, 12):
py_version = "EmitApiPython311"
assert str(type(domain)) == "<class '{}.InteractionDomain'>".format(py_version)
# assert str(type(TxRxMode)) == "<class '{}.tx_rx_mode'>".format(py_version)
assert str(type(TxRxMode.RX)) == "<class '{}.tx_rx_mode'>".format(py_version)
assert str(type(TxRxMode.TX)) == "<class '{}.tx_rx_mode'>".format(py_version)
assert str(type(TxRxMode.BOTH)) == "<class '{}.tx_rx_mode'>".format(py_version)
# assert str(type(ResultType)) == "<class '{}.result_type'>".format(py_version)
assert str(type(ResultType.SENSITIVITY)) == "<class '{}.result_type'>".format(py_version)
assert str(type(ResultType.EMI)) == "<class '{}.result_type'>".format(py_version)
assert str(type(ResultType.DESENSE)) == "<class '{}.result_type'>".format(py_version)
assert str(type(ResultType.POWER_AT_RX)) == "<class '{}.result_type'>".format(py_version)
@pytest.mark.skipif(config["desktopVersion"] <= "2023.1", reason="Skipped on versions earlier than 2023.2")
def test_14_version(self, add_app):
self.aedtapp = add_app(application=Emit)
less_info = self.aedtapp.version(False)
more_info = self.aedtapp.version(True)
if less_info:
assert str(type(less_info)) == "<class 'str'>"
assert str(type(more_info)) == "<class 'str'>"
assert len(more_info) > len(less_info)
@pytest.mark.skipif(
config["desktopVersion"] <= "2023.1",
reason="Skipped on versions earlier than 2023.2",
)
def test_15_basic_run(self, add_app):
self.aedtapp = add_app(application=Emit)
assert len(self.aedtapp.results.revisions) == 0
# place components and generate the appropriate number of revisions
rad1 = self.aedtapp.modeler.components.create_component("UE - Handheld")
ant1 = self.aedtapp.modeler.components.create_component("Antenna")
ant1.move_and_connect_to(rad1)
bands = rad1.bands()
for band in bands:
band.enabled = True
rad2 = self.aedtapp.modeler.components.create_component("Bluetooth Low Energy (LE)")
ant2 = self.aedtapp.modeler.components.create_component("Antenna")
ant2.move_and_connect_to(rad2)
rad3 = self.aedtapp.modeler.components.create_component("Bluetooth Low Energy (LE)")
ant3 = self.aedtapp.modeler.components.create_component("Antenna")
ant3.move_and_connect_to(rad3)
rev = self.aedtapp.results.analyze()
assert len(self.aedtapp.results.revisions) == 1
if self.aedtapp._emit_api is not None:
path = self.aedtapp.oproject.GetPath()
subfolder = ""
for f in os.scandir(path):
if os.path.splitext(f.name)[1].lower() in ".aedtresults":
subfolder = os.path.join(f.path, "EmitDesign1")
file = max([f for f in os.scandir(subfolder)], key=lambda x: x.stat().st_mtime)
self.aedtapp._emit_api.load_project(file.path)
assert rev.revision_loaded
domain = self.aedtapp.results.interaction_domain()
assert domain is not None
engine = self.aedtapp._emit_api.get_engine()
assert engine is not None
assert engine.is_domain_valid(domain)
assert rev.is_domain_valid(domain)
interaction_unrun = rev.get_interaction(domain)
assert interaction_unrun is not None
assert not interaction_unrun.is_valid()
interaction = engine.run(domain)
assert interaction is not None
assert interaction.is_valid()
interaction2 = rev.run(domain)
assert interaction2 is not None
assert interaction2.is_valid()
self.aedtapp.results.delete_revision(rev.name)
assert not interaction.is_valid()
assert not interaction2.is_valid()
domain.set_receiver("dummy")
assert not rev.name in self.aedtapp.results.revision_names()
assert not engine.is_domain_valid(domain)
assert not rev.is_domain_valid(domain)
rad4 = self.aedtapp.modeler.components.create_component("MD400C")
ant4 = self.aedtapp.modeler.components.create_component("Antenna")
ant4.move_and_connect_to(rad4)
self.aedtapp.oeditor.Delete([rad1.name, ant1.name])
rev2 = self.aedtapp.results.analyze()
domain2 = self.aedtapp.results.interaction_domain()
domain2.set_receiver("MD400C")
domain2.set_interferer(rad3.name)
if config["desktopVersion"] >= "2024.1":
rev2.n_to_1_limit = 0
assert rev2.is_domain_valid(domain2)
interaction3 = rev2.run(domain2)
assert interaction3 is not None
assert interaction3.is_valid()
worst_domain = interaction3.get_worst_instance(ResultType.EMI).get_domain()
assert worst_domain.receiver_name == rad4.name
assert len(worst_domain.interferer_names) == 1
assert worst_domain.interferer_names[0] == rad3.name
domain2.set_receiver(rad3.name)
domain2.set_interferer(rad2.name)
assert rev2.is_domain_valid(domain2)
interaction3 = rev2.run(domain2)
assert interaction3 is not None
assert interaction3.is_valid()
worst_domain = interaction3.get_worst_instance(ResultType.EMI).get_domain()
assert worst_domain.receiver_name == rad3.name
assert len(worst_domain.interferer_names) == 1
assert worst_domain.interferer_names[0] == rad2.name # rad3 is the receiver in this domain
@pytest.mark.skipif(
config["desktopVersion"] < "2024.1",
reason="Skipped on versions earlier than 2024.1",
)
def test_16_optimal_n_to_1_feature(self, add_app):
self.aedtapp = add_app(application=Emit)
# place components and generate the appropriate number of revisions
rad1 = self.aedtapp.modeler.components.create_component("Bluetooth")
ant1 = self.aedtapp.modeler.components.create_component("Antenna")
ant1.move_and_connect_to(rad1)
rad2 = self.aedtapp.modeler.components.create_component("MD401C")
ant2 = self.aedtapp.modeler.components.create_component("Antenna")
ant2.move_and_connect_to(rad2)
rad3 = self.aedtapp.modeler.components.create_component("MD400C")
ant3 = self.aedtapp.modeler.components.create_component("Antenna")
ant3.move_and_connect_to(rad3)
rad4 = self.aedtapp.modeler.components.create_component("LT401")
ant4 = self.aedtapp.modeler.components.create_component("Antenna")
ant4.move_and_connect_to(rad4)
assert len(self.aedtapp.results.revisions) == 0
rev = self.aedtapp.results.analyze()
assert len(self.aedtapp.results.revisions) == 1
radiosRX = rev.get_receiver_names()
bandsRX = rev.get_band_names(radiosRX[0], TxRxMode.RX)
radiosTX = rev.get_interferer_names()
domain = self.aedtapp.results.interaction_domain()
domain.set_receiver(radiosRX[0], bandsRX[0])
# check n_to_1_limit can be set to different values
self.aedtapp.results.revisions[-1].n_to_1_limit = 1
assert self.aedtapp.results.revisions[-1].n_to_1_limit == 1
self.aedtapp.results.revisions[-1].n_to_1_limit = 0
assert self.aedtapp.results.revisions[-1].n_to_1_limit == 0
# get number of 1-1 instances
assert self.aedtapp.results.revisions[-1].get_instance_count(domain) == 52851
interaction = self.aedtapp.results.revisions[-1].run(domain)
instance = interaction.get_worst_instance(ResultType.EMI)
assert instance.get_value(ResultType.EMI) == 76.02
# rerun with N-1
self.aedtapp.results.revisions[-1].n_to_1_limit = 2 ** 20
assert self.aedtapp.results.revisions[-1].n_to_1_limit == 2 ** 20
assert self.aedtapp.results.revisions[-1].get_instance_count(domain) == 11652816
interaction = self.aedtapp.results.revisions[-1].run(domain)
instance = interaction.get_worst_instance(ResultType.EMI)
domain2 = instance.get_domain()
assert len(domain2.interferer_names) == 2
assert instance.get_value(ResultType.EMI) == 82.04
# rerun with 1-1 only (forced by domain)
domain.set_interferer(radiosTX[0])
assert self.aedtapp.results.revisions[-1].get_instance_count(domain) == 19829
interaction = self.aedtapp.results.revisions[-1].run(domain)
instance = interaction.get_worst_instance(ResultType.EMI)
assert instance.get_value(ResultType.EMI) == 76.02
@pytest.mark.skipif(
config["desktopVersion"] <= "2023.1",
reason="Skipped on versions earlier than 2023.2",
)
def test_17_availability_1_to_1(self, add_app):
self.aedtapp = add_app(application=Emit)
# place components and generate the appropriate number of revisions
rad1 = self.aedtapp.modeler.components.create_component("MD400C")
ant1 = self.aedtapp.modeler.components.create_component("Antenna")
ant1.move_and_connect_to(rad1)
rad2 = self.aedtapp.modeler.components.create_component("MD400C")
ant2 = self.aedtapp.modeler.components.create_component("Antenna")
ant2.move_and_connect_to(rad2)
assert len(self.aedtapp.results.revisions) == 0
rev = self.aedtapp.results.analyze()
assert len(self.aedtapp.results.revisions) == 1
rad3 = self.aedtapp.modeler.components.create_component("Mini UAS Video RT Airborne")
ant3 = self.aedtapp.modeler.components.create_component("Antenna")
ant3.move_and_connect_to(rad3)
rad4 = self.aedtapp.modeler.components.create_component("GPS Airborne Receiver")
ant4 = self.aedtapp.modeler.components.create_component("Antenna")
ant4.move_and_connect_to(rad4)
rev2 = self.aedtapp.results.analyze()
assert len(self.aedtapp.results.revisions) == 2
domain = self.aedtapp.results.interaction_domain()
radiosRX = rev2.get_receiver_names()
bandsRX = rev2.get_band_names(radiosRX[0], TxRxMode.RX)
domain.set_receiver(radiosRX[0], bandsRX[0])
radiosTX = rev2.get_interferer_names(InterfererType.TRANSMITTERS)
bandsTX = rev2.get_band_names(radiosTX[0], TxRxMode.TX)
domain.set_interferer(radiosTX[0], bandsTX[0])
assert len(self.aedtapp.results.revisions) == 2
radiosRX = rev2.get_receiver_names()
bandsRX = rev2.get_band_names(radiosRX[0], TxRxMode.RX)
domain.set_receiver(radiosRX[0], bandsRX[0])
radiosTX = rev2.get_interferer_names(InterfererType.TRANSMITTERS)
bandsTX = rev2.get_band_names(radiosTX[0], TxRxMode.TX)
domain.set_interferer(radiosTX[0], bandsTX[0])
assert domain.receiver_name == "MD400C"
assert domain.receiver_band_name == "Rx"
assert domain.receiver_channel_frequency == -1.0
assert domain.interferer_names == ["MD400C"]
assert domain.interferer_band_names == ["Tx"]
assert domain.interferer_channel_frequencies == [-1.0]
revision = self.aedtapp.results.revisions[0]
assert revision.get_instance_count(domain) == 31626
interaction = revision.run(domain)
available_warning = interaction.get_availability_warning(domain)
assert available_warning == ""
availability = interaction.get_availability(domain)
assert availability == 1.0
valid_availability = interaction.has_valid_availability(domain)
assert valid_availability
rev3 = self.aedtapp.results.analyze()
assert len(self.aedtapp.results.revisions) == 2
radiosTX = rev3.get_interferer_names(InterfererType.TRANSMITTERS)
radiosRX = rev3.get_receiver_names()
assert len(radiosTX) == 3
assert len(radiosRX) == 4
rev4 = self.aedtapp.results.get_revision(rev.name)
assert len(self.aedtapp.results.revisions) == 2
radiosTX = rev4.get_interferer_names(InterfererType.TRANSMITTERS)
radiosRX = rev4.get_receiver_names()
assert len(radiosTX) == 2
assert len(radiosRX) == 2
@pytest.mark.skipif(
config["desktopVersion"] <= "2023.1" or TEST_REVIEW_FLAG,
reason="Skipped on versions earlier than 2023.2",
)
def test_18_interference_scripts_no_filter(self, add_app):
self.aedtapp = add_app(project_name="interference", application=Emit, subfolder=TEST_SUBFOLDER)
# Generate a revision
rev = self.aedtapp.results.analyze()
# Test with no filtering
expected_interference_colors = [["white", "green", "yellow"], ["red", "green", "white"]]
expected_interference_power = [["N/A", 16.64, 56.0], [60.0, 16.64, "N/A"]]
expected_protection_colors = [["white", "yellow", "yellow"], ["yellow", "yellow", "white"]]
expected_protection_power = [["N/A", -20.0, -20.0], [-20.0, -20.0, "N/A"]]
domain = self.aedtapp.results.interaction_domain()
interference_colors = []
interference_power_matrix = []
protection_colors = []
protection_power_matrix = []
interference_colors, interference_power_matrix = rev.interference_type_classification(domain)
protection_colors, protection_power_matrix = rev.protection_level_classification(
domain, global_protection_level=True, global_levels=[30, -4, -30, -104]
)
assert interference_colors == expected_interference_colors
assert interference_power_matrix == expected_interference_power
assert protection_colors == expected_protection_colors
assert protection_power_matrix == expected_protection_power
@pytest.mark.skipif(
TEST_REVIEW_FLAG,
reason="Test under review in 2024.1",
)
def test_19_radio_protection_levels(self, add_app):
self.aedtapp = add_app(project_name="interference", application=Emit, subfolder=TEST_SUBFOLDER)
# Generate a revision
rev = self.aedtapp.results.analyze()
domain = self.aedtapp.results.interaction_domain()
# Test protection level with radio-specific protection levels
expected_protection_colors = [["white", "orange", "red"], ["yellow", "orange", "white"]]
expected_protection_power = [["N/A", -20.0, -20.0], [-20.0, -20.0, "N/A"]]
protection_levels = {
"Global": [30.0, -4.0, -30.0, -104.0],
"Bluetooth": [30.0, -4.0, -22.0, -104.0],
"GPS": [30.0, -22.0, -30.0, -104.0],
"WiFi": [-22.0, -25.0, -30.0, -104.0],
}
protection_colors = []
protection_power_matrix = []
protection_colors, protection_power_matrix = rev.protection_level_classification(
domain, global_protection_level=False, protection_levels=protection_levels
)
assert protection_colors == expected_protection_colors
assert protection_power_matrix == expected_protection_power
@pytest.mark.skipif(
config["desktopVersion"] <= "2023.1" or TEST_REVIEW_FLAG,
reason="Skipped on versions earlier than 2023.2",