Many things work, some don't. Notably, genPOI doesn't work, and there's some signedness comparison stuff going on in the C extension. This also completely drops support for Python 2, as maintaining a C extension for both Python 2 and 3 is a pain and not worth it for the 9 months that Python 2 is still going to be supported upstream. The documentation needs to be adjusted as well. All of the few tests we have pass, and rendering a map works, both with a configuration file and without. We can also use optimizeimages. Concerns #1528.
39 lines
1.5 KiB
Python
39 lines
1.5 KiB
Python
import unittest
|
|
|
|
import os
|
|
|
|
from overviewer_core import world
|
|
|
|
class ExampleWorldTest(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
# Make sure that test/data/worlds/example exists
|
|
# if it doesn't, then give a little
|
|
if not os.path.exists("test/data/worlds/exmaple"):
|
|
raise Exception("test data doesn't exist. Maybe you need to init/update your submodule?")
|
|
|
|
def test_basic(self):
|
|
"Basic test of the world constructor and regionset constructor"
|
|
w = world.World("test/data/worlds/exmaple")
|
|
|
|
regionsets = w.get_regionsets()
|
|
self.assertEqual(len(regionsets), 3)
|
|
|
|
regionset = regionsets[0]
|
|
self.assertEqual(regionset.get_region_path(0,0), 'test/data/worlds/exmaple/DIM-1/region/r.0.0.mcr')
|
|
self.assertEqual(regionset.get_region_path(-1,0), 'test/data/worlds/exmaple/DIM-1/region/r.-1.0.mcr')
|
|
self.assertEqual(regionset.get_region_path(1,1), 'test/data/worlds/exmaple/DIM-1/region/r.0.0.mcr')
|
|
self.assertEqual(regionset.get_region_path(35,35), None)
|
|
|
|
# a few random chunks. reference timestamps fetched with libredstone
|
|
self.assertEqual(regionset.get_chunk_mtime(0,0), 1316728885)
|
|
self.assertEqual(regionset.get_chunk_mtime(-1,-1), 1316728886)
|
|
self.assertEqual(regionset.get_chunk_mtime(5,0), 1316728905)
|
|
self.assertEqual(regionset.get_chunk_mtime(-22,16), 1316786786)
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|