def test_get_cell_parts_returns_cell_text_on_simple_cells(self): assert TableQuestionKnowledgeGraph._get_cell_parts('Team') == [ ('fb:part.team', 'Team') ] assert TableQuestionKnowledgeGraph._get_cell_parts('2006') == [ ('fb:part.2006', '2006') ] assert TableQuestionKnowledgeGraph._get_cell_parts('Wolfe Tones') == [ ('fb:part.wolfe_tones', 'Wolfe Tones') ]
def test_get_cell_parts_on_past_failure_cases(self): parts = TableQuestionKnowledgeGraph._get_cell_parts( 'Checco D\'Angelo\n "Jimmy"') assert set(parts) == {('fb:part.checco_d_angelo', "Checco D\'Angelo"), ('fb:part._jimmy', '"Jimmy"')}
def test_get_cell_parts_handles_multiple_splits(self): parts = TableQuestionKnowledgeGraph._get_cell_parts( 'this, has / lots\n of , commas') assert set(parts) == {('fb:part.this', 'this'), ('fb:part.has', 'has'), ('fb:part.lots', 'lots'), ('fb:part.of', 'of'), ('fb:part.commas', 'commas')}
def test_get_cell_parts_splits_on_commas(self): parts = TableQuestionKnowledgeGraph._get_cell_parts( 'United States, Los Angeles') assert set(parts) == {('fb:part.united_states', 'United States'), ('fb:part.los_angeles', 'Los Angeles')}