Example #1
0
    def test_assign_step_multiple_functional_elements_all_none_present(self):
        """Test assignment of multiple elements when all are not present."""

        test_cache = AssignmentCache()
        parent_genome_property = GenomeProperty(accession_id='GenProp0065',
                                                name='YOLO',
                                                property_type="TEMP")

        step = [
            ('--', ''),
            ('SN', '1'),
            ('ID', 'Aferr subtype specific proteins'),
            ('EV', 'IPR017545; TIGR03114;'),  # NO
            ('TG', 'GO:0043571;'),
            ('ID', 'Yolo subtype specific proteins'),
            ('EV', 'IPR017545; TIGR03115;'),  # NO
            ('TG', 'GO:0043571;')
        ]

        parsed_step = parse_steps(step)[0]
        parsed_step.parent = parent_genome_property

        step_assignment = assign_step(test_cache, parsed_step)

        self.assertEqual(step_assignment, 'NO')
        self.assertEqual(test_cache.get_step_assignment('GenProp0065', 1),
                         'NO')
Example #2
0
    def test_cache_flush(self):
        """Test that the cache can be properly flushed."""

        test_cache = AssignmentCache()
        test_cache.cache_property_assignment('GenProp0067', 'YES')
        test_cache.cache_property_assignment('GenProp0092', 'NO')
        test_cache.cache_step_assignment('GenProp0067', 1, 'YES')
        test_cache.cache_step_assignment('GenProp0092', 1, 'NO')

        test_cache.flush_property_from_cache('GenProp0067')

        self.assertEqual(test_cache.get_property_assignment("GenProp0067"),
                         None)
        self.assertEqual(test_cache.get_step_assignment("GenProp0067", 1),
                         None)
        self.assertEqual(len(test_cache.property_assignments), 1)
        self.assertEqual(len(test_cache.step_assignments), 1)