コード例 #1
0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.        
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Fix sys.path
from setup_env import fix_sys_path
fix_sys_path()

# Python imports
import copy
import csv
import logging
from optparse import OptionParser
import os
import simplejson

# SDL imports
from sdl import interval

# Goole App Engine imports
from django.utils import simplejson
from google.appengine.ext.bulkload import transform
コード例 #2
0
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

__author__ = "John Wieczorek"
__author__ = "Aaron Steele"
__copyright__ = "Copyright 2011 University of California at Berkeley"

import setup_env

setup_env.fix_sys_path()

from geomancer.core import *
from geomancer import constants

import math
import logging
import os
import unittest
import simplejson


class TestGeomancer(unittest.TestCase):
    def test_distanceunits(self):
        distunits = constants.DistanceUnits.all()
        for unit in distunits:
コード例 #3
0
#!/usr/bin/env python

import setup_env
setup_env.fix_sys_path()

import cache
from cache import Cache

import unittest
import logging
import os
import simplejson
import yaml
import utils

import gm

class TestLocality(unittest.TestCase):
    
    def test_create_multi(self):
        locs = gm.Locality.create_muti('5 miles west of berkeley, california')
        self.assertEqual(2, len(locs))
        locs = gm.Locality.create_muti('5 miles west of berkeley, california;usa')
        self.assertEqual(3, len(locs))

class TestGeomancer(unittest.TestCase):
    # def test_predict(self):
    #     cache = gm.Cache('gmtest.cache.sqlite3.db')
    #     config = yaml.load(open('gm.yaml', 'r'))        
    #     predictor = gm.PredictionApi(config, cache)
    #     geomancer = gm.Geomancer(cache, predictor)