def index(self, config) -> LocalElementsIndex: error = config["error"] if "error" in config else "" if error == "index": raise SelectorIndexError("test") else: elements = ["skip", "retry3", "retryN", "pass"] return LocalElementsIndex(rows=scaffold_elementmap(elements))
def test_index(additionals): additionals.emptySelector.start_indexing() # test element_map.csv is what it should be eidx = additionals.emptySelector.disk.read_elements_index("empty") emap = scaffold_elementmap(["el1", "el2", "el3"]) for idx, row in enumerate(eidx.rows): assert row.id == emap[idx + 1][0]
def test_index(additionals): additionals.emptySelector.start_indexing() assert os.path.exists(additionals.emptySelector.ELEMENT_MAP) # test element_map.csv is what it should be with open(additionals.emptySelector.ELEMENT_MAP, "r") as f: emreader = csv.reader(f, delimiter=",") rows = [l for l in emreader] assert rows == scaffold_elementmap(["el1", "el2", "el3"])
def index(self, config): if not os.path.exists(self.disk.read_query(self.name)): df = scaffold_elementmap(["el1", "el2", "el3"]) df = [ x + [STUB_PATHS.imagejpg] if idx > 0 else (x + ["path"]) for idx, x in enumerate(df) ] return LocalElementsIndex(rows=df) else: return None
def index(self, config): if not os.path.exists(self.ELEMENT_MAP): df = scaffold_elementmap(["el1", "el2", "el3"]) return df else: return None