Skip to content

TST: test_reshape.py issues #6081

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

Closed
dsm054 opened this issue Jan 25, 2014 · 3 comments · Fixed by #6184
Closed

TST: test_reshape.py issues #6081

dsm054 opened this issue Jan 25, 2014 · 3 comments · Fixed by #6184
Milestone

Comments

@dsm054
Copy link
Contributor

dsm054 commented Jan 25, 2014

test_custom_var_and_value_name refers to several variables which aren't defined, namely df, var_name, and value_name, all of which should probably have self. in front of them:

        result18 = melt(df, id_vars=['id1', 'id2'],
                        value_vars='A', var_name=self.var_name, value_name=self.value_name)
        self.assertEqual(result18.columns.tolist(), ['id1', 'id2', 'var', 'val'])

        result19 = melt(self.df, id_vars=['id1', 'id2'],
                        value_vars=['A', 'B'], var_name=self.var_name, value_name=self.value_name)
        expected19 = DataFrame({'id1': self.df['id1'].tolist() * 2,
                                'id2': self.df['id2'].tolist() * 2,
                                var_name: ['A']*10 + ['B']*10,
                                value_name: self.df['A'].tolist() + self.df['B'].tolist()},

But I was a little surprised that this wasn't causing an exception, and it turns out to be because test_reshape.py contains

   def test_custom_var_and_value_name(self):
        [code here]

   def test_custom_var_and_value_name(self):
        self.df.columns.name = 'foo'
        result20 = melt(self.df)
        self.assertEqual(result20.columns.tolist(), ['foo', 'value'])

and so the original test is getting clobbered. I'm not sure if they should be merged or if since the second one changes self.df it needs to be kept on its own or not.

@jreback
Copy link
Contributor

jreback commented Jan 25, 2014

what happens if u rename 2nd test?

@dsm054
Copy link
Contributor Author

dsm054 commented Jan 25, 2014

The first test stops at each unknown name. If you fix those, both tests pass.

@jreback
Copy link
Contributor

jreback commented Jan 29, 2014

want to do a PR for this?

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 a pull request may close this issue.

2 participants