1 | import unittest |
||
0 ignored issues
–
show
|
|||
2 | import os |
||
3 | from faker import Faker |
||
4 | from pyrandimg.randimg_provider import RandImgProvider |
||
5 | |||
6 | |||
7 | class TestRandImgProvider(unittest.TestCase): |
||
0 ignored issues
–
show
This class should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
8 | def setUp(self): |
||
9 | """ Initialize each unit test """ |
||
10 | self.faker = Faker() |
||
11 | self.faker.add_provider(RandImgProvider) |
||
12 | |||
13 | def test_generate_default_image_url(self): |
||
0 ignored issues
–
show
This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
14 | self.assertRegex(self.faker.image_url(), r'^(https?\:\/\/)?www\.rand\-img\.com\/720\/480$') |
||
0 ignored issues
–
show
|
|||
15 | |||
16 | def test_generate_image_url_with_custom_width(self): |
||
0 ignored issues
–
show
The name
test_generate_image_url_with_custom_width does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
17 | self.assertRegex(self.faker.image_url(200), r'^(https?\:\/\/)?www\.rand\-img\.com\/200\/480$') |
||
0 ignored issues
–
show
|
|||
18 | self.assertRegex(self.faker.image_url(980), r'^(https?\:\/\/)?www\.rand\-img\.com\/980\/480$') |
||
0 ignored issues
–
show
|
|||
19 | |||
20 | def test_generate_image_url_with_custom_width_and_height(self): |
||
0 ignored issues
–
show
The name
test_generate_image_url_...custom_width_and_height does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
21 | self.assertRegex(self.faker.image_url(200, 500), r'^(https?\:\/\/)?www\.rand\-img\.com\/200\/500$') |
||
0 ignored issues
–
show
|
|||
22 | self.assertRegex(self.faker.image_url(320, 280), r'^(https?\:\/\/)?www\.rand\-img\.com\/320\/280$') |
||
0 ignored issues
–
show
|
|||
23 | self.assertRegex(self.faker.image_url(1920, 1080), r'(https?\:\/\/)?www\.rand\-img\.com\/1920\/1080') |
||
0 ignored issues
–
show
|
|||
24 | |||
25 | def test_generate_image_url_with_category(self): |
||
0 ignored issues
–
show
The name
test_generate_image_url_with_category does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
26 | self.assertRegex(self.faker.image_url(200, 500, 'food'), r'^(https?\:\/\/)?www\.rand\-img\.com\/200\/500\/food$') |
||
0 ignored issues
–
show
|
|||
27 | self.assertRegex(self.faker.image_url(500, 653, 'sky'), r'^(https?\:\/\/)?www\.rand\-img\.com\/500\/653\/sky$') |
||
0 ignored issues
–
show
|
|||
28 | |||
29 | def test_generate_rand_image_url(self): |
||
0 ignored issues
–
show
This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
30 | self.assertRegex( |
||
31 | self.faker.squared_image_url(320, rand=True), |
||
0 ignored issues
–
show
|
|||
32 | r'^(https?\:\/\/)?www\.rand\-img\.com\/320\/320\?rand=\d+$' |
||
33 | ) |
||
34 | |||
35 | def test_generate_default_squared_image_url(self): |
||
0 ignored issues
–
show
The name
test_generate_default_squared_image_url does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
36 | self.assertRegex(self.faker.squared_image_url(200), r'^(https?\:\/\/)?www\.rand\-img\.com\/200\/200$') |
||
0 ignored issues
–
show
|
|||
37 | |||
38 | def test_generate_squared_image_url_with_category(self): |
||
0 ignored issues
–
show
The name
test_generate_squared_image_url_with_category does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
39 | self.assertRegex( |
||
40 | self.faker.squared_image_url(200, 'food'), |
||
0 ignored issues
–
show
|
|||
41 | r'^(https?\:\/\/)?www\.rand\-img\.com\/200\/200\/food$' |
||
42 | ) |
||
43 | self.assertRegex( |
||
44 | self.faker.squared_image_url(1024, 'sky'), |
||
0 ignored issues
–
show
|
|||
45 | r'^(https?\:\/\/)?www\.rand\-img\.com\/1024\/1024\/sky$' |
||
46 | ) |
||
47 | |||
48 | def test_image_url_with_parameters(self): |
||
0 ignored issues
–
show
This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
49 | self.assertRegex( |
||
50 | self.faker.image_url(720, 480, 'food', rand=True, blur=4, gray=1), |
||
0 ignored issues
–
show
|
|||
51 | r'https?:\/\/www\.rand\-img\.com\/720\/480/food\?([(\&?rand\=\d+)(\&?blur\=4)(\&?gray\=1)])' |
||
0 ignored issues
–
show
|
|||
52 | ) |
||
53 | self.assertRegex( |
||
54 | self.faker.image_url(250, 120, 'fashion', rand=False, blur=4, gray=1), |
||
0 ignored issues
–
show
|
|||
55 | r'https?:\/\/www\.rand\-img\.com\/250\/120/fashion\?([(\&?blur\=4)(\&?gray\=1)])' |
||
56 | ) |
||
57 | |||
58 | def test_get_gif(self): |
||
0 ignored issues
–
show
This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
59 | self.assertRegex(self.faker.gif_url(), r'^(https?\:\/\/)?www\.rand\-img\.com\/gif$') |
||
0 ignored issues
–
show
|
|||
60 | |||
61 | def test_get_gif_with_rand(self): |
||
0 ignored issues
–
show
This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
62 | self.assertRegex(self.faker.gif_url(True), r'^(https?\:\/\/)?www\.rand\-img\.com\/gif\?rand\=\d+$') |
||
0 ignored issues
–
show
|
|||
63 | |||
64 | def test_download_gif(self): |
||
0 ignored issues
–
show
This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
65 | gif = self.faker.gif() |
||
0 ignored issues
–
show
|
|||
66 | gif_dirname = os.path.dirname(gif) |
||
0 ignored issues
–
show
|
|||
67 | _, file_ext = os.path.splitext(gif) |
||
68 | |||
69 | self.assertEqual('.gif', file_ext) |
||
70 | self.assertTrue(os.path.exists(gif)) |
||
71 | os.remove(gif) |
||
72 | |||
73 | def test_download_gif_with_dirname(self): |
||
0 ignored issues
–
show
This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
74 | os.mkdir('output') |
||
75 | output_dir = os.path.join(os.getcwd(), 'output') |
||
76 | gif = self.faker.gif(dir=output_dir) |
||
0 ignored issues
–
show
|
|||
77 | gif_dirname = os.path.dirname(gif) |
||
78 | _, file_ext = os.path.splitext(gif) |
||
79 | |||
80 | self.assertEqual(output_dir, gif_dirname) |
||
81 | self.assertEqual('.gif', file_ext) |
||
82 | self.assertTrue(os.path.exists(gif)) |
||
83 | os.remove(gif) |
||
84 | os.rmdir(output_dir) |
||
85 | |||
86 | def test_download_gif_with_invalid_argument_exception(self): |
||
0 ignored issues
–
show
The name
test_download_gif_with_invalid_argument_exception does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
87 | pass |
||
88 | |||
89 | def test_download_image(self): |
||
0 ignored issues
–
show
This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
90 | gif = self.faker.gif() |
||
0 ignored issues
–
show
|
|||
91 | gif_dirname = os.path.dirname(gif) |
||
0 ignored issues
–
show
|
|||
92 | _, file_ext = os.path.splitext(gif) |
||
93 | |||
94 | self.assertEqual('.gif', file_ext) |
||
95 | self.assertTrue(os.path.exists(gif)) |
||
96 | os.remove(gif) |
||
97 | |||
98 | View Code Duplication | def test_download_image_with_dirname(self): |
|
0 ignored issues
–
show
The name
test_download_image_with_dirname does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
99 | os.mkdir('output') |
||
100 | output_dir = os.path.join(os.getcwd(), 'output') |
||
101 | image = self.faker.image(dir=output_dir) |
||
0 ignored issues
–
show
|
|||
102 | image_dirname = os.path.dirname(image) |
||
103 | _, file_ext = os.path.splitext(image) |
||
104 | |||
105 | self.assertEqual(output_dir, image_dirname) |
||
106 | self.assertEqual('.jpg', file_ext) |
||
107 | self.assertTrue(os.path.exists(image)) |
||
108 | os.remove(image) |
||
109 | os.rmdir(output_dir) |
||
110 | |||
111 | View Code Duplication | def test_download_image_with_dirname_and_filename(self): |
|
0 ignored issues
–
show
The name
test_download_image_with_dirname_and_filename does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
112 | os.mkdir('output') |
||
113 | output_dir = os.path.join(os.getcwd(), 'output') |
||
114 | image = self.faker.image(dir=output_dir, filename='testing.png') |
||
0 ignored issues
–
show
|
|||
115 | image_dirname = os.path.dirname(image) |
||
116 | _, file_ext = os.path.splitext(image) |
||
117 | |||
118 | self.assertEqual(output_dir, image_dirname) |
||
119 | self.assertEqual('.png', file_ext) |
||
120 | self.assertTrue(os.path.exists(image)) |
||
121 | os.remove(image) |
||
122 | os.rmdir(output_dir) |
||
123 | |||
124 | def test_download_image_with_exception(self): |
||
0 ignored issues
–
show
The name
test_download_image_with_exception does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
125 | pass |
||
126 | |||
127 | def test_download_image_with_invalid_argument_exception(self): |
||
0 ignored issues
–
show
The name
test_download_image_with...alid_argument_exception does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
128 | pass |
||
129 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.