New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DONOTMERGE] Simplified FauxFactory
class definition.
#47
Conversation
def generate_html(cls, length=5): | ||
return gen_html(length) | ||
# Get information from ``fauxfactory`` module | ||
for key, val in fauxfactory.__dict__.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for key, val in dict(fauxfactory).items():
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fauxfactory
is a module and non-iterable.
In [1]: from fauxfactory import FauxFactory
In [2]: FauxFactory.generate_alp
FauxFactory.generate_alpha FauxFactory.generate_alphanumeric
In [3]: FauxFactory.generate_alpha(3)
Out[3]: u'QjP' )$ make test-all
coverage run -m unittest discover --start-directory tests --top-level-director
y .
..............................................................................
..............................................................................
----------------------------------------------------------------------
Ran 156 tests in 0.805s
OK |
@@ -23,7 +23,7 @@ def test_not_none(self): | |||
|
|||
""" | |||
generators = ( | |||
partial(codify, 'make-me-unicode'), | |||
partial(FauxFactory.codify, 'make-me-unicode'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, this is not backward-compatible.
What happens if a new |
Unless I misunderstood you, all functions from the module are automatically added to |
fb6b257
to
330e150
Compare
Using |
def codify(data): | ||
# (missing-docstring) pylint:disable=C0111 | ||
return _make_unicode(data) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flake8 should complain about this missing line. It looks for two blank lines preceding each class or function definition.
As an example, let's say a function |
This breakage is unnecessary. We should be able to independently vary the |
This pull requests proposes to simplify the definition of the ``FauxFactory`` class for backwards compatibility by looking into the module's own set of functions and individually adding them to the class using ``setaatr``, and removing a long list of function definitions that were calling the newer set of functions.
@Ichimonji10 are you then NACKing this PR? :) |
330e150
to
e606e36
Compare
It's just worth weighing the costs and benefits here. We get the benefit of terse, nice-looking code, but at the cost of breaking backward compatibility in some subtle ways. Of course, you could also make the argument that that's what version numbers are for, and we're just providing a close-enough approximation of backward compatibility. |
FauxFactory
class definition.FauxFactory
class definition.
Getting all sorts of issues with Travis and Python3 |
This pull requests proposes to simplify the definition of the
FauxFactory
class for backwards compatibility by looking into themodule's own set of functions and individually adding them to the class
using
setaatr
, and removing a long list of function definitions thatwere calling the newer set of functions.