def test_build_device_set_from_filter_func_with_regex(r_name_file): def my_filter_regex(key, value): ba1s = re.compile("^.*BA1.*") return value["class_id"] == 91 and ba1s.match(key) fgcs = pyfgc_name.build_device_set(my_filter_regex) assert len(fgcs) == 77
def test_build_device_set_from_filter_func(r_name_file): def my_filter(key, value): return value["channel"] == 10 and value["class_id"] == 91 fgcs = pyfgc_name.build_device_set(my_filter) assert len(fgcs) == 20
def test_build_device_set_from_device_list(r_name_file): fgcs = pyfgc_name.build_device_set(['RFNA.866.01.ETH1', 'RFNA.866.02.ETH1']) assert len(fgcs) == 2
def test_build_device_with_suffix(r_name_file): fgcs_0 = pyfgc_name.build_device_set("RPCEK.361.BT.RBHZ10") fgcs_1 = pyfgc_name.build_device_set("RPCEK.361.BT.RBHZ10.SP") assert len(fgcs_0) == 1 assert len(fgcs_1) == 1 assert fgcs_0.pop() != fgcs_1.pop()
def test_build_device_set_from_regex(r_name_file): fgcs = pyfgc_name.build_device_set("rpz.*400.*rch.*") assert len(fgcs) == 31
def test_build_device_set_from_simple_regex(r_name_file): fgcs = pyfgc_name.build_device_set("rpzes.866.15.eth1") assert len(fgcs) == 1