Commit Graph

61 Commits

Author SHA1 Message Date
Aviv Palivoda
8bf0d93bb2 Refactor string.splitlines 2020-01-24 22:53:44 +02:00
Aviv Palivoda
4a9e87b80d Support keepends in Str.splitlines 2020-01-24 12:58:51 +02:00
Alvin Lindstam
59666f7e0f Make string iterator test include non-ascii 2020-01-19 15:48:43 +01:00
Abe
6a1580141b Implement the '%' string format code for integers 2020-01-04 19:54:54 -07:00
Abe
765089d560 Add support for the % format code for floats.
Contributes to #1656
2020-01-03 16:14:24 -07:00
Abe
30473d3058 Add support for string formatting of floats with ":f" format code
Also adds automatic conversion of int -> float when the ":f"
format code is specified.

Fixes a f-string formatting style regression introduced in #1625.
2019-12-31 18:52:46 -07:00
Abe
325fb4c3a3 Add str.format_map method 2019-12-23 16:29:24 -07:00
coolreader18
2a03a6df44 Add encoding arg to str, fix bytes.__add__ return type 2019-11-28 13:33:25 -06:00
J Regex
84999557cb add some tests 2019-10-31 09:27:14 +09:00
coolreader18
368fe7294d Fix underscores for isupper 2019-10-27 22:52:01 -05:00
Timur Makarchuk
027a25c123 Merge branch 'master' into string.__repr__ 2019-10-05 22:14:34 +03:00
Timur Makarchuk
4b962b89d7 Implement some __ne__ methods (#1446)
* Implement some __ne__ methods

Added test snippets from `__ne__` methods

* Fix incompatability in str.__eq__ befaviour

Previously "".__eq__(1) returned "False", which is not the case in
cpython.
Not it's returning 'NotImplemented', as it should
2019-10-06 00:50:02 +09:00
Timur
70fb3f69ef cpython compatible "".__repr__
Fixes #1390
2019-10-05 01:17:17 +03:00
Daniel Alley
02ea0b629f Handle unicode indexing by character, not by grapheme
Python isn't grapheme aware, so for compatibility sake, we shouldn't be
either.

closes #1417
2019-10-01 12:37:16 -04:00
Jeong YunWon
758073db07 Add _msg back to assert_raises 2019-09-17 18:52:16 +09:00
Jeong YunWon
dc8057a1c2 Refactor snippets/testutil 2019-09-17 17:37:24 +09:00
HyeockJinKim
9a0078214a Add test for str 2019-09-12 06:52:34 +09:00
Noah
aa14a6bc48 Merge pull request #1273 from jmg7173/master
Add floating point formatting
2019-08-16 03:29:31 -05:00
ChJR
1dceae9205 Add str.__rmod__() method. #190 (#1262)
* Add str.__rmod__ method.

* Add tests for str.__rmod__ method.

* Improve test for str.__rmod__ method.

* Change str.__rmod__ method return value type.

* Format with rustfmt.

* Remove not required code of str.__rmod__ method.

* Improve with clippy.
2019-08-16 08:40:32 +02:00
MinGyo Jung
e1ac729770 #1224 Add floating point formatting test for int 2019-08-15 18:52:57 +09:00
MinGyo Jung
d508f8ad7c #1224 Add test code for floating point formatting
Not supports #.#f format
2019-08-15 17:36:11 +09:00
Marcin Pajkowski
6aeec34df0 Add tests for str.__iter__ and str.__next__ 2019-07-24 03:17:05 +02:00
Windel Bouwman
30979d9f27 Merge pull request #1043 from yanganto/feat/unicode-iterals
support unicode literal
2019-06-19 19:13:13 +02:00
Antonio Yang
974dc683e4 support unicode literal
- support unicode literal \x with 2 digits
- support unicode literal \u with 4 digits
- support unicode literal \U with 8 digits
- avoid to parse \x as unicode literal in bytes
2019-06-20 00:30:38 +08:00
Michel Heily
64af5c43df Add some test snippets for modulo string formatting 2019-06-17 19:35:09 +03:00
coolreader18
740e8387b8 Merge pull request #1027 from alanjds/format-bang
Feature: str.format accepting !r, !s and !a
2019-06-10 10:56:00 -05:00
Alan Justino
f0a2b4c50b Apply the {!r} on str.format calls
By the Python docs, the `!` forces a conversion of the argument before
applying the normal formating logic described after the `:` marker.

See: https://docs.python.org/3.4/library/string.html#format-string-syntax
2019-06-09 18:11:10 -03:00
Alan Justino
65d0093822 Dont fail on '{!r}'.format(...) 2019-06-09 13:46:13 -03:00
Antonio Yang
f76be43d26 str.isprintable
- check unicode type by unicode_categories
- rm redundant check of empty string
2019-06-09 23:33:38 +08:00
Jeong YunWon
7f2560c9e1 Add str.encode for utf-8 2019-05-29 21:25:34 +09:00
ZapAnton
a2e64c0425 objstr: Replaced the unwrap_or with the OverflowError 2019-05-25 16:38:51 +03:00
Seo Sanghyeon
433434a1bb Fix rsplit 2019-05-21 23:01:04 +09:00
Windel Bouwman
e1416f5ecc Merge pull request #967 from skinny121/str_xwith_tuple_arg
Accept tuple for first arg in str.startswith and str.endswith
2019-05-12 16:13:25 +02:00
Windel Bouwman
878cc3b120 Merge pull request #943 from Furyzer0/master
[WIP] implement str.translate and str.maketrans
2019-05-12 15:04:31 +02:00
ben
90711f10a0 Accept tuple for first arg in str.startswith and str.endswith 2019-05-12 13:14:27 +12:00
zer0
268cb8d217 fix str.maketrans 2 and 3 arguments cases 2019-05-11 23:58:42 +03:00
Jeong YunWon
c0f14eace3 Fix str.isidentifier() and add tests snippets 2019-05-11 14:30:47 +09:00
zer0
6e05795521 added str.maketrans 2019-05-11 01:03:22 +03:00
zer0
b15a584168 added small test to snippets 2019-05-10 23:47:11 +03:00
Yonatan Goldschmidt
857a7014c2 Enable and extend strings/membership tests 2019-05-03 15:11:14 +03:00
Yonatan Goldschmidt
d1730a53ad Add basic string multiplication tests 2019-05-03 03:07:15 +03:00
Seo Sanghyeon
0e9acdc12b Fix justification 2019-04-26 15:33:37 +09:00
Seo Sanghyeon
f38f263d93 Implement stripping with arguments 2019-04-25 20:33:30 +09:00
ben
d84b8b52a5 Fix the tuple from rpartition being in wrong order when sub isn't
contained within the string
2019-04-25 10:37:59 +12:00
jgirardet
73dbcfbe01 Add bytes.center
fix str.center
add some tests
introduce is_byte
2019-04-13 08:23:40 +02:00
Adrian Wielgosik
2131a8130c Clean up some tests 2019-03-25 17:59:51 +01:00
Adrian Wielgosik
b81a0a16d8 Convert most remaining string methods to implicit args
Also support out-of-range start/end params for some functions.
2019-03-07 20:39:57 +01:00
janczer
aac1ce4e07 Fix the str.{__lt__, __gt__} and add the methods str.{__le__, __ge__} 2019-02-10 16:40:09 +01:00
ichyo
d1b034e3b9 Avoid using \xhh for string 2019-02-05 23:54:39 +09:00
ichyo
fc779c2e3a Use the number of characters instead of bytes for str.__len__ 2019-02-05 23:26:13 +09:00