Opened 4 months ago

Closed 4 months ago

#27693 closed defect (fixed)

py3: fix src/sage/misc/classcall_metaclass.pyx

Reported by: chapoton Owned by:
Priority: minor Milestone: sage-8.8
Component: python3 Keywords:
Cc: embray, jdemeyer, fbissey Merged in:
Authors: Erik Bray Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: d65e714 (Commits) Commit: d65e714ca0393a715cad100c9718751ac19579bb
Dependencies: Stopgaps:

Description

traceback:

sage -t --long src/sage/misc/classcall_metaclass.pyx
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 109, in sage.misc.classcall_metaclass.ClasscallMetaclass.__cinit__
Failed example:
    isinstance(FOO, ClasscallMetaclass)  # indirect doctest
Expected:
    True
Got:
    False
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 145, in sage.misc.classcall_metaclass.ClasscallMetaclass._set_classcall
Failed example:
    BAR()
Expected:
    1
Got:
    <__main__.BAR object at 0x7f9a3fbd8588>
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 151, in sage.misc.classcall_metaclass.ClasscallMetaclass._set_classcall
Failed example:
    FOO._set_classcall(ConstantFunction(2))
Exception raised:
    Traceback (most recent call last):
      File "/home/u1/chapoton/sage3/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 671, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/u1/chapoton/sage3/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 1095, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.misc.classcall_metaclass.ClasscallMetaclass._set_classcall[7]>", line 1, in <module>
        FOO._set_classcall(ConstantFunction(Integer(2)))
    AttributeError: type object 'FOO' has no attribute '_set_classcall'
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 152, in sage.misc.classcall_metaclass.ClasscallMetaclass._set_classcall
Failed example:
    FOO()
Expected:
    2
Got:
    <__main__.FOO object at 0x7f9a3e5d44a8>
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 158, in sage.misc.classcall_metaclass.ClasscallMetaclass._set_classcall
Failed example:
    BAR()
Expected:
    1
Got:
    <__main__.BAR object at 0x7f9a3fbd8588>
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 207, in sage.misc.classcall_metaclass.ClasscallMetaclass.__call__
Failed example:
    Foo()
Expected:
    calling classcall
    calling new
    calling init
    <__main__.Foo object at ...>
Got:
    calling new
    calling init
    <__main__.Foo object at 0x7f9a3e6a2438>
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 216, in sage.misc.classcall_metaclass.ClasscallMetaclass.__call__
Failed example:
    Bar()
Expected:
    calling classcall
    calling new
    calling init
    <__main__.Bar object at ...>
Got:
    calling new
    calling init
    <__main__.Bar object at 0x7f9a3e497320>
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 231, in sage.misc.classcall_metaclass.ClasscallMetaclass.__call__
Failed example:
    FooNoInherits()
Expected:
    calling private classcall
    <__main__.FooNoInherits object at ...>
Got:
    <__main__.FooNoInherits object at 0x7f9a3e497400>
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 254, in sage.misc.classcall_metaclass.ClasscallMetaclass.__call__
Failed example:
    Foo2()
Expected:
    calling private classcall
    <__main__.Foo2 object at ...>
Got:
    <__main__.Foo2 object at 0x7f9a3e497320>
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 259, in sage.misc.classcall_metaclass.ClasscallMetaclass.__call__
Failed example:
    Bar2()
Expected:
    calling classcall with <class '__main__.Bar2'>
    <__main__.Bar2 object at ...>
Got:
    <__main__.Bar2 object at 0x7f9a3e497630>
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 324, in sage.misc.classcall_metaclass.ClasscallMetaclass.__call__
Failed example:
    Exc()
Expected:
    Traceback (most recent call last):
    ...
    ValueError: Calling classcall
Got:
    <__main__.Exc object at 0x7f9a3eb0a048>
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 383, in sage.misc.classcall_metaclass.ClasscallMetaclass.__get__
Failed example:
    bar = obj.Inner()
Exception raised:
    Traceback (most recent call last):
      File "/home/u1/chapoton/sage3/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 671, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/u1/chapoton/sage3/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 1095, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.misc.classcall_metaclass.ClasscallMetaclass.__get__[5]>", line 1, in <module>
        bar = obj.Inner()
    TypeError: __init__() missing 1 required positional argument: 'instance'
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 385, in sage.misc.classcall_metaclass.ClasscallMetaclass.__get__
Failed example:
    bar.instance == obj
Exception raised:
    Traceback (most recent call last):
      File "/home/u1/chapoton/sage3/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 671, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/u1/chapoton/sage3/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 1095, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.misc.classcall_metaclass.ClasscallMetaclass.__get__[6]>", line 1, in <module>
        bar.instance == obj
    NameError: name 'bar' is not defined
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 390, in sage.misc.classcall_metaclass.ClasscallMetaclass.__get__
Failed example:
    Inner = Outer.Inner
Expected:
    calling __classget__(<class '__main__.Outer.Inner'>, None, <class '__main__.Outer'>)
Got:
    <BLANKLINE>
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 394, in sage.misc.classcall_metaclass.ClasscallMetaclass.__get__
Failed example:
    type(bar) is Inner
Exception raised:
    Traceback (most recent call last):
      File "/home/u1/chapoton/sage3/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 671, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/u1/chapoton/sage3/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 1095, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.misc.classcall_metaclass.ClasscallMetaclass.__get__[9]>", line 1, in <module>
        type(bar) is Inner
    NameError: name 'bar' is not defined
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 403, in sage.misc.classcall_metaclass.ClasscallMetaclass.__get__
Failed example:
    bind = obj.Inner
Expected:
    calling __classget__(<class '__main__.Outer.Inner'>, <__main__.Outer object at 0x...>, <class '__main__.Outer'>)
Got:
    <BLANKLINE>
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 405, in sage.misc.classcall_metaclass.ClasscallMetaclass.__get__
Failed example:
    bind
Expected:
    <functools.partial object at 0x...>
Got:
    <class '__main__.Outer.Inner'>
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 442, in sage.misc.classcall_metaclass.ClasscallMetaclass.__contains__
Failed example:
    1 in Foo
Exception raised:
    Traceback (most recent call last):
      File "/home/u1/chapoton/sage3/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 671, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/u1/chapoton/sage3/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 1095, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.misc.classcall_metaclass.ClasscallMetaclass.__contains__[2]>", line 1, in <module>
        Integer(1) in Foo
    TypeError: argument of type 'type' is not iterable
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 444, in sage.misc.classcall_metaclass.ClasscallMetaclass.__contains__
Failed example:
    2 in Foo
Exception raised:
    Traceback (most recent call last):
      File "/home/u1/chapoton/sage3/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 671, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/u1/chapoton/sage3/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 1095, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.misc.classcall_metaclass.ClasscallMetaclass.__contains__[3]>", line 1, in <module>
        Integer(2) in Foo
    TypeError: argument of type 'type' is not iterable
**********************************************************************
File "src/sage/misc/classcall_metaclass.pyx", line 492, in sage.misc.classcall_metaclass.typecall
Failed example:
    typecall(Bar)
Expected:
    Traceback (most recent call last):
    ...
    TypeError: Argument 'cls' has incorrect type (expected type, got classobj)
Got:
    <__main__.Bar object at 0x7f9a3e4978d0>
**********************************************************************
6 items had failures:
   6 of  21 in sage.misc.classcall_metaclass.ClasscallMetaclass.__call__
   1 of   4 in sage.misc.classcall_metaclass.ClasscallMetaclass.__cinit__
   2 of   8 in sage.misc.classcall_metaclass.ClasscallMetaclass.__contains__
   6 of  13 in sage.misc.classcall_metaclass.ClasscallMetaclass.__get__
   4 of  12 in sage.misc.classcall_metaclass.ClasscallMetaclass._set_classcall
   1 of   8 in sage.misc.classcall_metaclass.typecall
    [80 tests, 20 failures, 0.04 s]

Change History (5)

comment:1 Changed 4 months ago by embray

  • Authors set to Erik Bray
  • Branch set to u/embray/python3/ticket-27693
  • Commit set to e593f3ac9f1c35743a3a4f504a784f6e0c43f58b
  • Priority changed from major to minor
  • Status changed from new to needs_review
  • Type changed from enhancement to defect

Here you go. These are just minor test failures; nothing impacting implementation that I'm aware of.


New commits:

e593f3apy3: Minor test fixes for sage.misc.classcall_metaclass

comment:2 Changed 4 months ago by git

  • Commit changed from e593f3ac9f1c35743a3a4f504a784f6e0c43f58b to d65e714ca0393a715cad100c9718751ac19579bb

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

d65e714py3: Minor test fixes for sage.misc.classcall_metaclass

comment:3 Changed 4 months ago by embray

(oops, in fixing some docstring language I introduced a new typo--fixed in last forced push).

comment:4 Changed 4 months ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

LGTM.

comment:5 Changed 4 months ago by vbraun

  • Branch changed from u/embray/python3/ticket-27693 to d65e714ca0393a715cad100c9718751ac19579bb
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.