beeware / voc

A transpiler that converts Python code into Java bytecode

Home Page:http://beeware.org/voc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overloading static method Dict.fromkeys() is not consistent

henne90gen opened this issue · comments

I was trying to implement the fromkeys_missing_iterable test in test_dict.

@org.python.Method(
       __doc__ = "Returns a new dict with keys from iterable and values equal to value."
)
public static org.python.Object fromkeys() {
    throw new org.python.exceptions.TypeError("fromkeys expected at least 1 arguments, got 0");
}

Adding this method lets the test pass, but only if I run it like this:

python -m unittest tests.datatypes.test_dict.DictTests.test_fromkeys_missing_iterable

Running the test case any other way fails as if I hadn't added the method.

See https://github.com/henne90gen/voc/tree/fromkeys_missing_iterable for details about the changes I've made.