-
Notifications
You must be signed in to change notification settings - Fork 188
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
- Loading branch information
zzl0
committed
Jun 17, 2022
1 parent
6f28c79
commit a7208c0
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 @@ | ||
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) |