Chromium Code Reviews| Index: third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations_unittest.py |
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations_unittest.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d3588a33f0d6fd1401bae197d17b5034457182e7 |
| --- /dev/null |
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations_unittest.py |
| @@ -0,0 +1,22 @@ |
| +from webkitpy.w3c.update_w3c_test_expectations import * |
|
qyearsley
2016/07/12 23:00:15
Good start to the unit test :-) Remember to add th
dcampb
2016/07/15 00:24:13
I know you were saying to refrain from using the *
qyearsley
2016/07/15 16:42:47
If you don't use * when importing, then your choic
|
| +import unittest |
|
qyearsley
2016/07/12 23:00:15
Regarding the imports:
1. Wildcard imports are ge
|
| + |
| + |
| +class UpdateW3cTestExpectationsTest(unittest.TestCase): |
|
qyearsley
2016/07/12 23:00:15
W3c -> W3C
|
| + |
| + def test_merge_platforms(self): |
| + example_one = {'foo/bar/man.html': {'one': {'expected': u'FAIL', 'actual': u'PASS', 'bug': 'crbug.com/626703'}, 'two': {'expected': "FAIL", 'actual': 'PASS', 'bug': 'crbug.com/626703'}}} |
|
qyearsley
2016/07/12 23:00:15
These are much easier to read when formatted more
|
| + example_two = {'foo/bar/man.html': {'one': {'expected': u'FAIL', 'actual': u'PASS', 'bug': 'crbug.com/626703'}, 'two': {'expected': u'FAIL', 'actual': u'TIMEOUT', 'bug': 'crbug.com/626703'}, 'three': {'expected': u'FAIL', 'actual': u'PASS', 'bug': 'crbug.com/626703'}}} |
| + self.assertEqual(update_platforms(example_one), {'foo/bar/man.html': {('two', 'one'): {'expected': u'FAIL', 'actual': u'PASS', 'bug': 'crbug.com/626703'}}}) |
| + self.assertEqual(update_platforms(example_two), {'foo/bar/man.html': {('three', 'one'): {'expected': u'FAIL', 'actual': u'PASS', 'bug': 'crbug.com/626703'}, 'two': {'expected': u'FAIL', 'actual': u'TIMEOUT', 'bug': 'crbug.com/626703'}}}) |
| + |
| + def test__get_expectations(self): |
|
qyearsley
2016/07/12 23:00:15
test__ -> test_
dcampb
2016/07/15 00:24:13
Should I be testing private functions? Or should I
qyearsley
2016/07/15 16:42:47
You can test private functions :-)
If it's possib
|
| + self.assertEqual(get_expectations({'expected': 'FAIL', 'actual': 'PASS'}), ['Pass']) |
| + self.assertEqual(get_expectations({'expected': 'FAIL', 'actual': 'TIMEOUT'}), ['Timeout']) |
| + self.assertEqual(get_expectations({'expected': 'TIMEOUT', 'actual': 'PASS'}), ['Pass', 'Timeout']) |
| + |
| + def test_create_line_list(self): |
| + example_one = {'foo/bar/man.html': {'one': {'expected': u'FAIL', 'actual': u'PASS', 'bug': 'crbug.com/626703'}, 'two': {'expected': "FAIL", 'actual': 'PASS', 'bug': 'crbug.com/626703'}}} |
| + example_two = {'foo/bar/man.html': {'one': {'expected': u'FAIL', 'actual': u'PASS', 'bug': 'crbug.com/626703'}, 'two': {'expected': u'FAIL', 'actual': u'TIMEOUT', 'bug': 'crbug.com/626703'}, 'three': {'expected': u'FAIL', 'actual': u'PASS', 'bug': 'crbug.com/626703'}}} |
| + self.assertEqual(create_line_list(example_one), ['crbug.com/626703 [ two ] foo/bar/man.html [ Pass ]', u'crbug.com/626703 [ one ] foo/bar/man.html [ Pass ]']) |
|
qyearsley
2016/07/12 23:00:15
Lines like this can also be made more readable by
|
| + self.assertEqual(create_line_list(example_two), [u'crbug.com/626703 [ three ] foo/bar/man.html [ Pass ]', u'crbug.com/626703 [ two ] foo/bar/man.html [ Timeout ]', u'crbug.com/626703 [ one ] foo/bar/man.html [ Pass ]']) |