-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
expression: fix SimpleString's quote method (#704)
* expression: fix SimpleString's quote method * Add missing copyright header Co-authored-by: zzl0 <[email protected]> Co-authored-by: Luke Petre <[email protected]>
- Loading branch information
1 parent
6f28c79
commit 7ca1bd1
Showing
2 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# | ||
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
import unittest | ||
|
||
import libcst as cst | ||
|
||
|
||
class TestSimpleString(unittest.TestCase): | ||
def test_quote(self) -> None: | ||
test_cases = [ | ||
('"a"', '"'), | ||
("'b'", "'"), | ||
('""', '"'), | ||
("''", "'"), | ||
('"""c"""', '"""'), | ||
("'''d'''", "'''"), | ||
('""""e"""', '"""'), | ||
("''''f'''", "'''"), | ||
('"""""g"""', '"""'), | ||
("'''''h'''", "'''"), | ||
('""""""', '"""'), | ||
("''''''", "'''"), | ||
] | ||
|
||
for s, expected_quote in test_cases: | ||
simple_string = cst.SimpleString(s) | ||
actual = simple_string.quote | ||
self.assertEqual(expected_quote, actual) |