Skip to content
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

context should have helper methods #8

Open
gabrielfalcao opened this issue Mar 15, 2012 · 1 comment
Open

context should have helper methods #8

gabrielfalcao opened this issue Mar 15, 2012 · 1 comment
Assignees

Comments

@gabrielfalcao
Copy link
Owner

the VariablesBag should have methods for

  • listing members
  • supporting either getattr or getitem

In other words, this test should pass:

from sure import scenario

def prepare(context):
    context["some_cool_variable"]= 123

def dismiss(context):
    context.list_members().should.equal(["some_cool_variable", "times_2"])

@scenario(prepare, dismiss)
def test_something(context):
    context.times_2 = context.some_cool_variable * 2
@ghost ghost assigned gabrielfalcao Mar 15, 2012
@ghost ghost assigned clarete Nov 8, 2012
@timofurrer
Copy link
Collaborator

Notes:

The context.list_members() can be done with context.keys() since the VariablesBag is inheriting from dict. However, to have stable tests you have to sort the keys first:

sorted(context.keys()).should.equal(["some_cool_variable", "times_2"])

At the moment the setitem syntax is not supported correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants