def test_fqon_of_function(self): def f(): pass self.assert_equal(util.fqon_of(f), __name__ + ".f") del f.__module__ self.assert_equal(util.fqon_of(f), "<unknown>.f") f = lambda: None self.assert_equal(util.fqon_of(f), __name__ + ".<lambda>") del f.__module__ self.assert_equal(util.fqon_of(f), "<unknown>.<lambda>")
def test_fqon_of_function(self): def f(): pass self.assert_equal(util.fqon_of(f), __name__ + '.f') del f.__module__ self.assert_equal(util.fqon_of(f), '<unknown>.f') f = lambda: None self.assert_equal(util.fqon_of(f), __name__ + '.<lambda>') del f.__module__ self.assert_equal(util.fqon_of(f), '<unknown>.<lambda>')
def test_fqon_of_builtin(self): self.assert_equal(util.fqon_of(None), 'NoneType') self.assert_equal(util.fqon_of(True), 'bool') self.assert_equal(util.fqon_of(False), 'bool') self.assert_equal(util.fqon_of(''), 'str') self.assert_equal(util.fqon_of([]), 'list') self.assert_equal(util.fqon_of({}), 'dict') self.assert_equal(util.fqon_of(1), 'int') self.assert_equal(util.fqon_of(3.14), 'float')
def test_fqon_of_builtin(self): self.assert_equal(util.fqon_of(None), "NoneType") self.assert_equal(util.fqon_of(True), "bool") self.assert_equal(util.fqon_of(False), "bool") self.assert_equal(util.fqon_of(""), "str") self.assert_equal(util.fqon_of([]), "list") self.assert_equal(util.fqon_of({}), "dict") self.assert_equal(util.fqon_of(1), "int") self.assert_equal(util.fqon_of(3.14), "float")
def test_fqon_of_class(self): class O: pass class N(object): pass self.assert_equal(util.fqon_of(O), __name__ + '.O') self.assert_equal(util.fqon_of(O()), __name__ + '.O') O.__module__ = None self.assert_equal(util.fqon_of(O), '<unknown>.O') self.assert_equal(util.fqon_of(O()), '<unknown>.O') if five.PY2: del O.__module__ self.assert_equal(util.fqon_of(O), 'O') self.assert_equal(util.fqon_of(O()), 'O') self.assert_equal(util.fqon_of(N), __name__ + '.N') self.assert_equal(util.fqon_of(N()), __name__ + '.N') N.__module__ = None self.assert_equal(util.fqon_of(N), '<unknown>.N') self.assert_equal(util.fqon_of(N()), '<unknown>.N')
def test_fqon_of_class(self): class O: pass class N(object): pass self.assert_equal(util.fqon_of(O), __name__ + ".O") self.assert_equal(util.fqon_of(O()), __name__ + ".O") O.__module__ = None self.assert_equal(util.fqon_of(O), "<unknown>.O") self.assert_equal(util.fqon_of(O()), "<unknown>.O") if five.PY2: del O.__module__ self.assert_equal(util.fqon_of(O), "O") self.assert_equal(util.fqon_of(O()), "O") self.assert_equal(util.fqon_of(N), __name__ + ".N") self.assert_equal(util.fqon_of(N()), __name__ + ".N") N.__module__ = None self.assert_equal(util.fqon_of(N), "<unknown>.N") self.assert_equal(util.fqon_of(N()), "<unknown>.N")
def test_fqon_of_module(self): self.assert_equal(util.fqon_of(os), 'os') self.assert_equal(util.fqon_of(util), 'ayame.util')
def test_fqon_of_module(self): self.assert_equal(util.fqon_of(os), "os") self.assert_equal(util.fqon_of(util), "ayame.util")