def test_indexSearch(self, dataFrame): datasearch = DataSearch('Test', dataFrame=dataFrame) filterString = 'indexSearch([0])' datasearch.setFilterString(filterString) ret, valid = datasearch.search() assert valid assert sum(ret) == 1 filterString = 'indexSearch([0, 2])' datasearch.setFilterString(filterString) ret, valid = datasearch.search() assert valid assert sum(ret) == 2 filterString = 'indexSearch([0, 1, 2])' datasearch.setFilterString(filterString) ret, valid = datasearch.search() assert valid assert sum(ret) == 3 filterString = 'indexSearch([99])' datasearch.setFilterString(filterString) ret, valid = datasearch.search() assert valid assert sum(ret) == 0
def test_extentSearch(self, geoDataFrame, dataFrame): datasearch = DataSearch('Test', dataFrame=geoDataFrame) filterString = 'extentSearch(51, 9, 55, 14)' datasearch.setFilterString(filterString) ret, valid = datasearch.search() assert valid assert sum(ret) == 1 datasearch = DataSearch('Test', dataFrame=dataFrame) filterString = 'extentSearch(51, 9, 55, 14)' datasearch.setFilterString(filterString) ret, valid = datasearch.search() assert valid assert sum(ret) == 0
def test_freeSearch(self, dataFrame): datasearch = DataSearch('Test', dataFrame=dataFrame) filterString = 'freeSearch("0")' datasearch.setFilterString(filterString) ret, valid = datasearch.search() assert valid assert sum(ret) == 2 filterString = 'freeSearch(1)' datasearch.setFilterString(filterString) ret, valid = datasearch.search() assert not valid filterString = 'freeSearch("12")' datasearch.setFilterString(filterString) ret, valid = datasearch.search() assert valid assert sum(ret) == 1
def test_search(self, dataFrame): datasearch = DataSearch('Test', dataFrame=dataFrame) filterString = 'Foo < 10' datasearch.setFilterString(filterString) ret, valid = datasearch.search() assert valid assert sum(ret) == 2 filterString = 'Foo < 10 and Bar' datasearch.setFilterString(filterString) ret, valid = datasearch.search() assert not valid filterString = '(Foo < 10) & (Bar > 1)' datasearch.setFilterString(filterString) ret, valid = datasearch.search() assert valid assert sum(ret) == 1 filterString = '(Monty < 10) & (Bar > 1)' datasearch.setFilterString(filterString) ret, valid = datasearch.search() assert not valid