Example #1
0
def verb_data(filename, la):
    """Generate verb data as part of a parametrized test.

    Each datum in the returned list is a 2-tuple containing a single
    form and the result set in which it is expected to appear.

    :param filename: the name of some test file.
    :param la: the upadeśa name of one of the lakāras.
    """
    test_cases = []
    ash = A.Ashtadhyayi()
    for dhatu, expected, person, number in load_forms(filename):
        d = Upadesha.as_dhatu(dhatu)
        p = Vibhakti(la).add_samjna(person, number)
        actual = set(ash.derive([d, p]))
        print actual

        test_cases.append((expected, actual))

    return test_cases
Example #2
0
def verb_data(filename, la):
    """Generate verb data as part of a parametrized test.

    Each datum in the returned list is a 2-tuple containing a single
    form and the result set in which it is expected to appear.

    :param filename: the name of some test file.
    :param la: the upadeśa name of one of the lakāras.
    """
    test_cases = []
    ash = A.Ashtadhyayi()
    for dhatu, expected, person, number in load_forms(filename):
        d = Upadesha.as_dhatu(dhatu)
        p = Vibhakti(la).add_samjna(person, number)
        actual = set(ash.derive([d, p]))
        print(actual)

        test_cases.append((expected, actual))

    return test_cases
Example #3
0
def dhatu_tester(filt, data):
    return filt.allows([Upadesha.as_dhatu(data)], 0)
Example #4
0
def test_derive(ashtadhyayi):
    dhatu = Upadesha.as_dhatu('BU')
    la = Vibhakti('la~w').add_samjna('prathama', 'ekavacana')
    items = [dhatu, la]
    assert 'Bavati' in ashtadhyayi.derive(items)
Example #5
0
def dhatu_tester(filt, data):
    return filt.allows([Upadesha.as_dhatu(data)], 0)