예제 #1
0
 def test_from_config_with_cache(self):
     c = LinearHashIndex.get_default_config()
     c['cache_element'][
         'type'] = 'smqtk.representation.data_element.memory_element.DataMemoryElement'
     i = LinearHashIndex.from_config(c)
     self.assertIsInstance(i.cache_element, DataMemoryElement)
     self.assertEqual(i.index, set())
예제 #2
0
    def test_get_config(self):
        i = LinearHashIndex()

        # Without cache element
        expected_c = LinearHashIndex.get_default_config()
        nose.tools.assert_equal(i.get_config(), expected_c)

        # With cache element
        i.cache_element = DataMemoryElement()
        expected_c['cache_element']['type'] = 'DataMemoryElement'
        nose.tools.assert_equal(i.get_config(), expected_c)
예제 #3
0
    def test_get_config(self):
        i = LinearHashIndex()

        # Without cache element
        expected_c = LinearHashIndex.get_default_config()
        self.assertEqual(i.get_config(), expected_c)

        # With cache element
        i.cache_element = DataMemoryElement()
        expected_c['cache_element']['type'] = 'DataMemoryElement'
        self.assertEqual(i.get_config(), expected_c)
예제 #4
0
    def test_get_config(self):
        i = LinearHashIndex()

        # Without cache element
        expected_c = LinearHashIndex.get_default_config()
        self.assertEqual(i.get_config(), expected_c)

        # With cache element
        i.cache_element = DataMemoryElement()
        expected_c['cache_element'][
            'type'] = 'smqtk.representation.data_element.memory_element.DataMemoryElement'
        self.assertEqual(i.get_config(), expected_c)
예제 #5
0
 def test_from_config_with_cache(self):
     c = LinearHashIndex.get_default_config()
     c['cache_element']['type'] = "DataMemoryElement"
     i = LinearHashIndex.from_config(c)
     nose.tools.assert_is_instance(i.cache_element, DataMemoryElement)
     nose.tools.assert_equal(i.index, set())
예제 #6
0
 def test_from_config_no_cache(self):
     # Default config is valid and specifies no cache.
     c = LinearHashIndex.get_default_config()
     i = LinearHashIndex.from_config(c)
     nose.tools.assert_is_none(i.cache_element)
     nose.tools.assert_equal(i.index, set())
예제 #7
0
 def test_default_config(self):
     c = LinearHashIndex.get_default_config()
     nose.tools.assert_equal(len(c), 1)
     nose.tools.assert_is_none(c['cache_element']['type'])
예제 #8
0
 def test_from_config_no_cache(self):
     # Default config is valid and specifies no cache.
     c = LinearHashIndex.get_default_config()
     i = LinearHashIndex.from_config(c)
     self.assertIsNone(i.cache_element)
     self.assertEqual(i.index, set())
예제 #9
0
 def test_default_config(self):
     c = LinearHashIndex.get_default_config()
     self.assertEqual(len(c), 1)
     self.assertIsNone(c['cache_element']['type'])
예제 #10
0
 def test_from_config_with_cache(self):
     c = LinearHashIndex.get_default_config()
     c['cache_element']['type'] = "DataMemoryElement"
     i = LinearHashIndex.from_config(c)
     self.assertIsInstance(i.cache_element, DataMemoryElement)
     self.assertEqual(i.index, set())
예제 #11
0
 def test_from_config_no_cache(self):
     # Default config is valid and specifies no cache.
     c = LinearHashIndex.get_default_config()
     i = LinearHashIndex.from_config(c)
     self.assertIsNone(i.cache_element)
     self.assertEqual(i.index, set())
예제 #12
0
 def test_default_config(self):
     c = LinearHashIndex.get_default_config()
     self.assertEqual(len(c), 1)
     self.assertIsNone(c['cache_element']['type'])