Skip to content

Conversation

@robin-oval
Copy link
Contributor

No description provided.

@tomvanmele
Copy link
Member

there is already a function like this in compas.geometry.Bezier. could you check how they relate?

@robin-oval
Copy link
Contributor Author

true! I moved that one from compas.geometry._primitives.curves to compas.utilities.functions and fixed the imports

Copy link
Member

@tomvanmele tomvanmele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you write a test for this one? should be a fairly easy one...


def test_binomial():
assert binomial(3, 1) == 3
assert binomial(21, 10) == 352716
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you make sure to test the boundary cases?
for example, what if one or both of the number is zero?
see the geometry tests for setting up tests that are expected to fail.
also you can parametrize the input so the two assertions count as two tests...

pytest.param(2, -1, 0, marks=pytest.mark.xfail(raises=ValueError)),
]
)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no spacing here, because the stuff above is a decorator for the function and should be "attached" to it...

:nosignatures:
fibonacci
binomial_coefficient
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be called binomial or the function renamed to binomial_coefficient? Or are these two different things?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think binomial_coefficient is the correct name.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but what I meant is, you called the function binomial but referenced in the docs as binomial_coefficient, so doc will fail to find it. Unless, there's a second function called binomial_coefficient that I'm not seeing...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am now using binomial_coefficient everywhere

@tomvanmele tomvanmele merged commit 905e749 into compas-dev:master Feb 13, 2019
@robin-oval robin-oval deleted the feature/binomial_coefficient branch February 14, 2019 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants