Posts

Showing posts with the label pycharm

Pycharm - no tests were found?

Image
Pycharm - no tests were found? I've been getting a No tests were found error in Pycharm and I can't figure out why I'm getting it... this is what I have for my point_test.py : point_test.py import unittest import sys import os sys.path.insert(0, os.path.abspath('..')) from ..point import Point class TestPoint(unittest.TestCase): def setUp(self): pass def xyCheck(self,x,y): point = Point(x,y) self.assertEqual(x,point.x) self.assertEqual(y,point.y) and this point.py , what I'm trying to test: point.py import unittest from .utils import check_coincident, shift_point class Point(object): def __init__(self,x,y,mark={}): self.x = x self.y = y self.mark = mark def patched_coincident(self,point2): point1 = (self.x,self.y) return check_coincident(point1,point2) def patched_shift(self,x_shift,y_shift): point = (self.x,self.y) self.x,self,y = shift_point(point,x_shif...

Annotate subclass's method?

Annotate subclass's method? Suppose I have a Mixin class Mixin , and a method a in this class uses another method b which will be in another Base class. I want to annotate b in class Mixin so that I can take the advantages of inspection. Mixin a b Base b Mixin The real usage is multiple inherition. I create a mixin for tornado.web.RequestHandler , and the subclass could inherit both RequestHandler and Mixin to get some useful functions. tornado.web.RequestHandler RequestHandler Mixin As far as I know, I can annotate b as Callable , but I cannot annotate its signature. b Callable class Base def b(): # do something class Mixin: b: Callable # not enough, losing signature. #b: RequestHandler.b # not work, still losing signature. def a(): # call b here. class subclass(Base, Mixin): pass BTW, I'm using Pycharm. Are you trying to annotate the subclass method or attribute? – Ramazan Polat ...