File: pytest_8.4.patch

package info (click to toggle)
flask-restful 0.3.10-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,312 kB
  • sloc: python: 3,945; makefile: 277; pascal: 26; sh: 20
file content (159 lines) | stat: -rw-r--r-- 4,446 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -37,11 +37,11 @@
 
 
 def test_unpack():
-    yield check_unpack, ("hey", 200, {}), unpack("hey")
-    yield check_unpack, (("hey",), 200, {}), unpack(("hey",))
-    yield check_unpack, ("hey", 201, {}), unpack(("hey", 201))
-    yield check_unpack, ("hey", 201, "foo"), unpack(("hey", 201, "foo"))
-    yield check_unpack, (["hey", 201], 200, {}), unpack(["hey", 201])
+    check_unpack( ("hey", 200, {}), unpack("hey") )
+    check_unpack( (("hey",), 200, {}), unpack(("hey",)) )
+    check_unpack( ("hey", 201, {}), unpack(("hey", 201)) )
+    check_unpack( ("hey", 201, "foo"), unpack(("hey", 201, "foo")) )
+    check_unpack( (["hey", 201], 200, {}), unpack(["hey", 201]) )
 
 
 # Add a dummy Resource to verify that the app is properly set.
--- a/tests/test_fields.py
+++ b/tests/test_fields.py
@@ -32,7 +32,7 @@
         (3, 3.0),
     ]
     for value, expected in values:
-        yield check_field, expected, fields.Float(), value
+        check_field(expected, fields.Float(), value)
 
 
 def test_boolean():
@@ -44,7 +44,7 @@
         ("0", True),      # Will this be a problem?
     ]
     for value, expected in values:
-        yield check_field, expected, fields.Boolean(), value
+        check_field(expected, fields.Boolean(), value)
 
 
 def test_rfc822_datetime_formatters():
@@ -58,7 +58,7 @@
          "Sat, 01 Jan 2011 22:59:59 -0000")
     ]
     for date_obj, expected in dates:
-        yield assert_equals, fields._rfc822(date_obj), expected
+        assert_equals(fields._rfc822(date_obj), expected)
 
 
 def test_iso8601_datetime_formatters():
@@ -76,7 +76,7 @@
          "2011-01-01T23:59:59+01:00")
     ]
     for date_obj, expected in dates:
-        yield assert_equals, fields._iso8601(date_obj), expected
+        assert_equals(fields._iso8601(date_obj), expected)
 
 
 class FieldsTestCase(unittest.TestCase):
--- a/tests/test_inputs.py
+++ b/tests/test_inputs.py
@@ -18,7 +18,7 @@
     ]
 
     for date_string, expected in dates:
-        yield assert_equal, inputs.datetime_from_rfc822(date_string), expected
+        assert_equal(inputs.datetime_from_rfc822(date_string), expected)
 
 
 def test_reverse_iso8601_datetime():
@@ -30,7 +30,7 @@
     ]
 
     for date_string, expected in dates:
-        yield assert_equal, inputs.datetime_from_iso8601(date_string), expected
+        assert_equal(inputs.datetime_from_iso8601(date_string), expected)
 
 
 def test_urls():
@@ -54,7 +54,7 @@
     ]
 
     for value in urls:
-        yield assert_equal, inputs.url(value), value
+        assert_equal(inputs.url(value), value)
 
 
 def check_bad_url_raises(value):
@@ -84,7 +84,7 @@
     ]
 
     for value in values:
-        yield check_bad_url_raises, value
+        check_bad_url_raises(value)
 
 
 def test_bad_url_error_message():
@@ -96,7 +96,7 @@
     ]
 
     for value in values:
-        yield check_url_error_message, value
+        check_url_error_message(value)
 
 
 def check_url_error_message(value):
@@ -119,7 +119,7 @@
     num_only = inputs.regex(r'^[0-9]+$')
 
     for value in cases:
-        yield raises, ValueError, lambda: num_only(value)
+        raises(ValueError, lambda: num_only(value))
 
 
 def test_regex_good_input():
@@ -132,7 +132,7 @@
     num_only = inputs.regex(r'^[0-9]+$')
 
     for value in cases:
-        yield assert_equal, num_only(value), value
+        assert_equal(num_only(value), value)
 
 
 def test_regex_bad_pattern():
@@ -150,7 +150,7 @@
     case_insensitive = inputs.regex(r'^[A-Z]+$', re.IGNORECASE)
 
     for value in cases:
-        yield assert_equal, case_insensitive(value), value
+        assert_equal(case_insensitive(value), value)
 
 
 def test_regex_flags_bad_input():
@@ -162,7 +162,7 @@
     case_sensitive = inputs.regex(r'^[A-Z]+$')
 
     for value in cases:
-        yield raises, ValueError, lambda: case_sensitive(value)
+        raises(ValueError, lambda: case_sensitive(value))
 
 
 class TypesTestCase(unittest.TestCase):
@@ -390,7 +390,7 @@
     ]
 
     for value, expected in intervals:
-        yield assert_equal, inputs.iso8601interval(value), expected
+        assert_equal(inputs.iso8601interval(value), expected)
 
 
 def test_invalid_isointerval_error():
@@ -415,8 +415,7 @@
     ]
 
     for bad_interval in bad_intervals:
-        yield (
-            raises,
+        raises(
             Exception,
             inputs.iso8601interval,
             bad_interval,