コード例 #1
0
ファイル: test_school.py プロジェクト: rhyolight/nupic.son
  def testMemcacheUsage(self, mock_func):
    """Tests that memcache is used to help to get predefined schools."""
    self.program.schools = 'mock key'

    # check that schools are not found in cache by the first call
    school_logic.getMappedByCountries(self.program)

    stats = memcache.get_stats()
    self.assertEqual(stats['misses'], 1)
    self.assertEqual(stats['hits'], 0)

    # check that schools are found in cache by the second call
    school_logic.getMappedByCountries(self.program)

    stats = memcache.get_stats()
    self.assertEqual(stats['misses'], 1)
    self.assertEqual(stats['hits'], 1)
コード例 #2
0
ファイル: test_school.py プロジェクト: rhyolight/nupic.son
 def testForProgramWithDefinedSchools(self, mock_func):
   """Tests for program that has predefined schools."""
   self.program.schools = 'mock key'
   school_map = school_logic.getMappedByCountries(self.program)
   self.assertDictEqual(school_map, EXPECTED_SCHOOL_MAP)
コード例 #3
0
ファイル: test_school.py プロジェクト: rhyolight/nupic.son
 def testForProgramWithNoDefinedSchools(self):
   """Tests for program that has no predefined schools."""
   school_map = school_logic.getMappedByCountries(self.program)
   self.assertDictEqual(school_map, {})