@@ -436,6 +436,24 @@ def test_non_atom_mtype9(self):
436436 def test_non_atom_mtype10 (self ):
437437 assert hedge ("(and/J (is/Pd.so hyperbase/Cp.s great/C))" ).mtype () == "R"
438438
439+ def test_atom_type_long_subtype (self ):
440+ assert hedge ("exp/Cmath" ).type () == "Cmath"
441+ assert hedge ("exp/Cmath" ).mtype () == "C"
442+
443+ def test_atom_role_long_subtype (self ):
444+ assert hedge ("was/Ppast.so" ).role () == ["Ppast" , "so" ]
445+ assert hedge ("was/Ppast.so" ).type () == "Ppast"
446+ assert hedge ("was/Ppast.so" ).mtype () == "P"
447+ assert hedge ("was/Ppast.so" ).argroles () == "so"
448+
449+ def test_non_atom_type_long_subtype (self ):
450+ assert hedge ("(was/Ppast.so john/C art/C)" ).type () == "Rpast"
451+ assert hedge ("(was/Ppast.so john/C art/C)" ).mtype () == "R"
452+
453+ def test_non_atom_type_long_modifier_subtype (self ):
454+ assert hedge ("(red/Mcolor shoes/Cc.p)" ).type () == "Cc"
455+ assert hedge ("(before/Tlong noon/C)" ).type () == "Slong"
456+
439457 def test_connector_type1 (self ):
440458 assert hedge ("hyperbase/Cp.s/1" ).connector_type () is None
441459
@@ -553,6 +571,26 @@ def test_atom_with_type6(self):
553571 def test_atom_with_type7 (self ):
554572 assert hedge ("a/Cn" ).atom_with_type ("P" ) is None
555573
574+ def test_atom_with_type_long_subtype1 (self ):
575+ edge = hedge ("(is/Pd.so john/Cmath rich/C)" )
576+ assert edge .atom_with_type ("Cmath" ) == hedge ("john/Cmath" )
577+
578+ def test_atom_with_type_long_subtype2 (self ):
579+ edge = hedge ("(is/Pd.so john/Cmath rich/C)" )
580+ assert edge .atom_with_type ("C" ) == hedge ("john/Cmath" )
581+
582+ def test_atom_with_type_long_subtype3 (self ):
583+ edge = hedge ("(is/Pd.so john/Cmath rich/C)" )
584+ assert edge .atom_with_type ("Cmusic" ) is None
585+
586+ def test_atom_with_type_partial_subtype_no_match (self ):
587+ edge = hedge ("(is/Pd.so john/Cmath rich/C)" )
588+ assert edge .atom_with_type ("Cm" ) is None
589+
590+ def test_atom_with_type_short_subtype_no_match_against_long (self ):
591+ edge = hedge ("(is/Pd.so john/Cmath rich/Cm)" )
592+ assert edge .atom_with_type ("Cm" ) == hedge ("rich/Cm" )
593+
556594 def test_argroles_connector_atom1 (self ):
557595 edge = hedge ("s/Bp.am" )
558596 assert edge .argroles () == "am"
0 commit comments