Commit Graph

1426 Commits

Author SHA1 Message Date
writtic
ed075cf71c Update remainder module of math
- Implement remainder function with test case
  - math.remainder was added to CPython in 3.7 and RustPython CI runs on 3.6
2019-11-11 22:27:46 +09:00
Noah
b5a18fa908 Merge pull request #1542 from RustPython/coolreader18/asyncawait
Make async def/await actually functional
2019-11-07 22:19:21 -06:00
Noah
c7702bd6db Merge pull request #1582 from palaviv/method-doc
Return function attributes in method
2019-11-07 22:14:34 -06:00
Aviv Palivoda
153ce3f3d7 Merge pull request #1581 from Writtic/writtic/improve_fromhex
Improve float.fromhex module representation case
2019-11-07 20:19:28 +02:00
coolreader18
6bc33fbca2 Add async for 2019-11-07 00:04:51 -06:00
coolreader18
30a2223c6f Fix tests 2019-11-07 00:04:51 -06:00
coolreader18
fe2946bc79 Add tests 2019-11-07 00:04:51 -06:00
Noah
52f1965c1c Merge pull request #1525 from alanjds/dummy_threading
`threading` support via dummy implementation
2019-11-06 22:23:55 -06:00
johan.park
6a2c721cbc Rectify test cases
- Erase fromhex test comments
- Recover float exponent test case
2019-11-05 15:12:02 +09:00
Noah
17b11a0855 Merge pull request #1578 from palaviv/with-traceback
with_traceback
2019-11-04 13:41:03 -06:00
Noah
82c4c9175b Merge pull request #1577 from Regexp96/isupper-and-lower
Fix issue #1575 distinguish between 'cased' and 'non-cased' characters
2019-11-04 10:56:08 -06:00
Aviv Palivoda
841e22434a Return function attributs in method 2019-11-02 19:34:10 +02:00
Aviv Palivoda
72989cdfd1 Merge pull request #1580 from seeeturtle/doc-f
Set docstring of function as None if not declared
2019-11-02 19:18:11 +02:00
johan.park
bbd274a498 Improve float.fromhex module representation case
- Embrace hexadecimal without '0x', '.', 'p'
- Embrace variety of 'nan', 'inf' case
- Still overflow and near min, max, 0, 1 case isn't handled
2019-11-03 02:06:44 +09:00
joshua1b
538181791b Set docstring of function as None if not declared
In cpython, if there is no docstring declared in function definition,
the `__doc__` attribute of the function is None.
So this implements the behavior.

Fix #1523
2019-11-02 23:47:44 +09:00
Aviv Palivoda
74b6d7c0f5 Allow None as with_tracebak arg 2019-11-02 12:23:57 +02:00
Noah
24cc67980c Merge pull request #1572 from RustPython/coolreader18/socket-socket2
Update _socket to use the socket2 crate; similar to the C sockets api
2019-11-01 19:49:40 -05:00
Aviv Palivoda
1fb868a08a Add test for exception with_traceback 2019-11-01 14:29:58 +02:00
Aviv Palivoda
1341a551d1 Merge pull request #1573 from palaviv/tb-object
Traceback object
2019-11-01 13:41:34 +02:00
Alan Justino
2e36df0acd Minimal test for threading module 2019-10-31 21:25:19 +01:00
Johan
40a22f217d Improve float.fromhex module of objfloat (#1552)
* Improve  float.fromhex module of objfloat

- Python float.fromhex can handle string of float and hex without `.`
  - For example '0.0', '-0.0', '0x0p0', '-0x0p0'
- Add test case mantioned

* Change unwrap to expect for error handling

* Improve error handling with pattern matching

- `expect` that can't express python vm error message changed to pattern match
- Erase duplicated test case

* Refactoring with or_else and map_err

- Use `or_else` instead of value condition and `match` statement
  - For floating-point input
- Use `map_err` instead of `match ` statement
  - For hexadecimal floating-point input without dot

* Add else condition
2019-10-31 19:54:28 +01:00
J Regex
84999557cb add some tests 2019-10-31 09:27:14 +09:00
coolreader18
460e1497ff Fix some minor stuff 2019-10-28 22:29:28 -05:00
coolreader18
d0b39f9f1d Add select test 2019-10-28 22:27:23 -05:00
coolreader18
25a571a38b Fix _socket.socket __new__/__init__, set timeout 2019-10-28 22:27:23 -05:00
coolreader18
368fe7294d Fix underscores for isupper 2019-10-27 22:52:01 -05:00
Aviv Palivoda
91bd78d8ca Change test so it would not print traceback 2019-10-27 22:47:18 +02:00
Aviv Palivoda
b41f871151 Add tests for traceback 2019-10-27 19:25:20 +02:00
Noah
914299a4bf Merge pull request #1565 from yanganto/whats_left_error
test.not_impl_gen ignore py module w/ import error
2019-10-26 16:40:06 -05:00
Noah
1a00ebd855 Merge pull request #1567 from HyeockJinKim/issue1527
Modify str to float
2019-10-26 15:45:44 -05:00
Noah
de02824c58 Merge pull request #1553 from RustPython/coolreader18/select
Add the select and selectors modules
2019-10-26 13:14:00 -05:00
HyeockJinKim
bc67dd1d91 Add tests for float 2019-10-26 14:19:48 +09:00
Windel Bouwman
6308be3dfe Merge pull request #1559 from vazrupe/fix-bytes
Fix panic when using non-collection in bytes()
2019-10-24 14:02:31 +02:00
yanganto
1f30557705 test.not_impl_gen ignore py module w/ import error
Ignore python module which cannot be imported and print error message thereof
2019-10-24 12:09:39 +08:00
Noah
55103c6658 Add very basic tests for select.select 2019-10-23 22:46:10 +00:00
Noah
8542224071 Merge pull request #1562 from ichyo/wrong-zero-div-optimization
Fix wrong const optimization for "1.0 / 0.0" case
2019-10-23 12:24:54 -05:00
ichyo
74c02d416e Fix wrong const optimization for "1.0 / 0.0" case
In cpython, "1.0 / 0.0" raises ZeroDivisionError
```
>>> 1.0 / 0.0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: float division by zer
```

but RustPython doesn't
```
>>>>> 1.0 / 0.0
inf
```

This is because they emits different byte codes.

```
$ echo "1.0 / 0.0" > zero-div.py

$ python -m dis zero-div.py
  1           0 LOAD_CONST               0 (1.0)
              2 LOAD_CONST               1 (0.0)
              4 BINARY_TRUE_DIVIDE
              6 POP_TOP
              8 LOAD_CONST               2 (None)
             10 RETURN_VALUE

$ cargo run --example dis zero-div.py
zero-div.py:
                 0 LoadConst            (inf)
                 1 Pop
                 2 LoadConst            (None)
                 3 ReturnValue
```

This commit stops optimization for zero division case
to generate same byte codes.
2019-10-24 00:26:02 +09:00
yanganto
9f2929a378 bytes.replace: replacing bytes w/ diff len
fix bug on replacing bytes with different length
2019-10-23 19:36:53 +08:00
HyeonGyu Lee (Vazrupe)
a1464b7078 Fix panic when using non-collection in bytes()
Fixes #1558
2019-10-23 18:23:33 +09:00
ichyo
0c12c201d8 Ignore deprecated module warning in a test script
When executing `./whats_left.sh`,
you may see several warning messages at beginning as follows
```
not_impl_gen.py:69: DeprecationWarning: the formatter module is deprecated
  return set(dir(__import__(name))) if name not in ("this", "antigravity") else None
not_impl_gen.py:69: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  return set(dir(__import__(name))) if name not in ("this", "antigravity") else None
not_impl_gen.py:69: DeprecationWarning: the macpath module is deprecated in 3.7 and will be removed in 3.8
  return set(dir(__import__(name))) if name not in ("this", "antigravity") else None
```

This fix will stop showing those messages
2019-10-23 01:31:56 +09:00
Noah
194b2cc1e4 Merge pull request #1550 from seeeturtle/docstring
objtype: Set __doc__ as None if not included
2019-10-22 00:07:10 -05:00
Windel Bouwman
40bbb6be1b Merge pull request #1551 from ChJR/feature/float-repr
Fix float.__repr__()
2019-10-20 21:14:09 +02:00
Windel Bouwman
e8bb4bb5ba Merge pull request #1549 from palaviv/refactor-pystruct
pystruct refactor
2019-10-20 14:11:56 +02:00
Windel Bouwman
11e8e6235d Merge pull request #1526 from seeeturtle/itertools
Implement itertools.product
2019-10-20 10:30:40 +02:00
joshua1b
da698eb7f9 Add test case 2019-10-20 17:03:42 +09:00
Aviv Palivoda
d0184a7ac2 struct.pack does not allow string as pack parameter 2019-10-20 10:13:40 +03:00
ChJR
fb206a0d2d Add float.__repr__() tests 2019-10-20 16:12:26 +09:00
johan.park
533aa2bc26 Update fmod module of math
- Implement fmod function with test case
2019-10-20 14:55:23 +09:00
joshua1b
8deb936c22 Implement itertools.product
This implements `itertools.product` of standard library.

Related with #1361
2019-10-20 14:47:22 +09:00
johan.park
731186a23d Improve modf module of math
- Add INF, NINF, NAN test case
- Apply code relevant to added the test case on the modf code
2019-10-19 10:36:20 +09:00