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

bytes as parameter crashes the expansion #134

Closed
aimjy opened this issue Dec 14, 2021 · 2 comments
Closed

bytes as parameter crashes the expansion #134

aimjy opened this issue Dec 14, 2021 · 2 comments
Labels
pr-wanted It would be great if someone wrote a PR for this!

Comments

@aimjy
Copy link

aimjy commented Dec 14, 2021

Using bytes as input parameter of a unittest will crash due to expansion issues.

e.g.

@parameterized.expand([                                                                                                                                                                                                                                                        
        ("a"*16),                                 #is fine                                                                                                                                                                                                                                 
        ("a" * 8 + "b" * 8),                   #is fine                                                                                                                                                                                                                                   
        (b"abcd" * 4)                          #will crash                                                                                                                                                                                                                                    
        ])                                                                                                                                                                                                                                                                         
    def test_value(self, case): 
        self.assertTrue(True)

Error message:

ERROR: test_value_2 (__main__.TestVal)                                                                                                                                                                                                                                       
----------------------------------------------------------------------                                                                                                                                                                                                             
Traceback (most recent call last):                                                                                                                                                                                                                                                 
  File "~/.local/lib/python3.9/site-packages/parameterized/parameterized.py", line 392, in standalone_func                                                                                                                                                            
    return func(*(a + p.args), **p.kwargs)                                                                                                                                                                                                                                         
TypeError: test_value() takes 2 positional arguments but 17 were given     
@KurumiSerori
Copy link

KurumiSerori commented Aug 27, 2022

+1
however this can be avoided by an encoding/decoding (e.g., Base64)

@wolever wolever added the pr-wanted It would be great if someone wrote a PR for this! label Mar 2, 2023
@wolever
Copy link
Owner

wolever commented Mar 2, 2023

Fixed #157

@wolever wolever closed this as completed in 41471f9 Mar 2, 2023
wolever added a commit that referenced this issue Mar 2, 2023
Fix #134 - wrap str, bytes, and any non-iterable input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-wanted It would be great if someone wrote a PR for this!
Projects
None yet
Development

No branches or pull requests

3 participants