Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

test_internal_utils.py 556 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  1. import pytest
  2. from torchvision._utils import sequence_to_str
  3. @pytest.mark.parametrize(
  4. ("seq", "separate_last", "expected"),
  5. [
  6. ([], "", ""),
  7. (["foo"], "", "'foo'"),
  8. (["foo", "bar"], "", "'foo', 'bar'"),
  9. (["foo", "bar"], "and ", "'foo' and 'bar'"),
  10. (["foo", "bar", "baz"], "", "'foo', 'bar', 'baz'"),
  11. (["foo", "bar", "baz"], "and ", "'foo', 'bar', and 'baz'"),
  12. ],
  13. )
  14. def test_sequence_to_str(seq, separate_last, expected):
  15. assert sequence_to_str(seq, separate_last=separate_last) == expected
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...