Refactor and new tests
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
import poc
|
||||
import random_seeds
|
||||
import clustering
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
from xyz import *
|
||||
@@ -1,6 +0,0 @@
|
||||
import plpy
|
||||
|
||||
def xyz():
|
||||
plpy.notice('XYZ...')
|
||||
r = plpy.execute("select * from pg_class where relname='pg_class'")
|
||||
return r[0]['reltype']
|
||||
10
python/crankshaft/crankshaft/random_seeds.py
Normal file
10
python/crankshaft/crankshaft/random_seeds.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import random
|
||||
import numpy
|
||||
|
||||
def set_random_seeds(value):
|
||||
"""
|
||||
Set the seeds of the RNGs (Random Number Generators)
|
||||
used internally.
|
||||
"""
|
||||
random.seed(value)
|
||||
numpy.random.seed(value)
|
||||
@@ -22,7 +22,7 @@ setup(
|
||||
license='MIT',
|
||||
|
||||
classifiers=[
|
||||
'Development Status :: 1 - Planning',
|
||||
'Development Status :: 3 - Alpha',
|
||||
'Intended Audience :: Mapping comunity',
|
||||
'Topic :: Maps :: Mapping Tools',
|
||||
'License :: OSI Approved :: MIT License',
|
||||
@@ -38,6 +38,8 @@ setup(
|
||||
'test': ['unittest', 'nose', 'mock'],
|
||||
},
|
||||
|
||||
# The choice of component versions is dictated by what's
|
||||
# provisioned in the production servers.
|
||||
install_requires=['pysal==1.11.0','numpy==1.6.1'],
|
||||
|
||||
requires=['pysal', 'numpy'],
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/usr/local/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import unittest
|
||||
|
||||
# from mock_plpy import MockPlPy
|
||||
# plpy = MockPlPy()
|
||||
#
|
||||
# import sys
|
||||
# sys.modules['plpy'] = plpy
|
||||
|
||||
from helper import plpy
|
||||
import crankshaft
|
||||
|
||||
class TestPoc(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
plpy._reset()
|
||||
|
||||
def test_should_have_xyz(self):
|
||||
plpy._define_result('select.*from\s+pg_class', [{'reltype': 111}])
|
||||
assert crankshaft.poc.xyz() == 111
|
||||
assert plpy.notices[0] == 'XYZ...'
|
||||
Reference in New Issue
Block a user