def testPopulation(self): ''' test adding population data from wikidata to GeoLite2 information ''' Locator.resetInstance() loc = Locator.getInstance() loc.populate_db() endpoint = None user = getpass.getuser() if self.debug: print("current user is %s" % user) # uncomment to refresh using wikidata # please note https://github.com/RDFLib/sparqlwrapper/issues/163 hits as of 2020-09 # endpoint='https://query.wikidata.org/sparql' # uncomment to use your own wikidata copy as an endpoint # if user=="wf": # use 2020 Apache Jena based wikidata copy #endpoint="http://jena.zeus.bitplan.com/wikidata" # use 2018 Blazegraph based wikidata copy #endpoint="http://blazegraph.bitplan.com/sparql" loc.getWikidataCityPopulation(loc.sqlDB, endpoint) tableList = loc.sqlDB.getTableList() uml = UML() title = """geograpy Tables 2020-09-26 [[https://github.com/somnathrakshit/geograpy3 © 2020 geograpy3 project]]""" plantUml = uml.tableListToPlantUml(tableList, title=title, packageName="geograpy3") if self.debug: print(plantUml)
def setUp(self,debug=False): ''' setUp test environment ''' TestCase.setUp(self) self.debug=debug msg=f"test {self._testMethodName}, debug={self.debug}" self.profile=Profiler(msg) Locator.resetInstance() locator=Locator.getInstance() locator.downloadDB() # actively test Wikidata tests? self.testWikidata = False
def testLocatorWithWikiData(self): ''' test Locator ''' Locator.resetInstance() loc=Locator.getInstance() #forceUpdate=True forceUpdate=False loc.populate_db(force=forceUpdate) tableList=loc.sqlDB.getTableList() expectedCities=800000 self.assertTrue(loc.db_recordCount(tableList,"countries")>=200) self.assertTrue(loc.db_recordCount(tableList,"regions")>=3000) self.assertTrue(loc.db_recordCount(tableList,"cities")>=expectedCities)
def testUML(self): ''' test adding population data from wikidata to GeoLite2 information ''' Locator.resetInstance() loc = Locator.getInstance() loc.populate_db() user = getpass.getuser() if self.debug: print("current user is %s" % user) tableList = loc.sqlDB.getTableList() uml = UML() title = """geograpy Tables 2021-08-13 [[https://github.com/somnathrakshit/geograpy3 © 2020-2021 geograpy3 project]]""" plantUml = uml.tableListToPlantUml(tableList, title=title, packageName="geograpy3") showUml = True if showUml or self.debug: print(plantUml)
def setUp(self): self.debug = True Locator.resetInstance() pass
def setUp(self): super().setUp(debug=False) Locator.resetInstance() pass