コード例 #1
0
 def test_float_input(self):
     result = transform_map_attrs_to_js("test-id", "test_key", 5.9)
     expected = "map_attrs['test-id'].test_key = '5.9';"
     self.assertEqual(expected, result)
コード例 #2
0
 def test_string_input(self):
     result = transform_map_attrs_to_js("test-id", "test_key",
                                        "nice string for testing purposes")
     expected = "map_attrs['test-id'].test_key = 'nice string for testing purposes';"
     self.assertEqual(expected, result)
コード例 #3
0
 def test_tuple_input(self):
     result = transform_map_attrs_to_js("test-id", "test_key", (1, 2, 3))
     expected = "map_attrs['test-id'].test_key = [1, 2, 3];"
     self.assertEqual(expected, result)
コード例 #4
0
 def test_false_input(self):
     result = transform_map_attrs_to_js("test-id", "test_key", False)
     expected = "map_attrs['test-id'].test_key = false;"
     self.assertEqual(expected, result)
コード例 #5
0
 def test_id_and_key(self):
     result = transform_map_attrs_to_js("test-id", "test_key", None)
     expected = "map_attrs['test-id'].test_key = "
     self.assertIn(expected, result)