Bug 1353074 - Use tuples for script arguments; r=maja_zf

The Python standard library uses tuples to define arguments for functions,
whenever they are invoked through meta programming.

The Marionette client only allows the list type for backwards
compatibility, so we prefer tuples in this case.

Another good argument for tuples is that tuples are immutable.

MozReview-Commit-ID: 72zPzYvBz7Q

--HG--
extra : rebase_source : 79315dd809e00c4c805bd0de3244b519e3ff286f
This commit is contained in:
Andreas Tolfsen 2017-04-03 19:14:16 +01:00
Родитель 42acd45542
Коммит cb1c619b93
1 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -96,24 +96,24 @@ class TestExecuteContent(MarionetteTestCase):
def test_argument_number(self):
self.assertEqual(
1, self.marionette.execute_script("return arguments[0]", [1]))
1, self.marionette.execute_script("return arguments[0]", (1,)))
self.assertEqual(
1.5, self.marionette.execute_script("return arguments[0]", [1.5]))
1.5, self.marionette.execute_script("return arguments[0]", (1.5,)))
def test_argument_boolean(self):
self.assertTrue(self.marionette.execute_script("return arguments[0]", [True]))
self.assertTrue(self.marionette.execute_script("return arguments[0]", (True,)))
def test_argument_string(self):
self.assertEqual(
"foo", self.marionette.execute_script("return arguments[0]", ["foo"]))
"foo", self.marionette.execute_script("return arguments[0]", ("foo",)))
def test_argument_array(self):
self.assertEqual(
[1, 2], self.marionette.execute_script("return arguments[0]", [[1, 2]]))
[1, 2], self.marionette.execute_script("return arguments[0]", ([1, 2],)))
def test_argument_object(self):
self.assertEqual({"foo": 1}, self.marionette.execute_script(
"return arguments[0]", [{"foo": 1}]))
"return arguments[0]", ({"foo": 1},)))
def test_globals(self):
for property in globals: