Commit Graph
1619 Commits
Author SHA1 Message Date
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
Oscar Shrimpton a794939c74 Add tests for slice.indices() 2019-10-20 20:27:50 +01: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
Jack Park 3fdc72de5d Resolved conflict 2019-10-18 07:18:50 +07:00
Jack Park fcc6635b1f Implemented range.__reduce__ 2019-10-18 07:01:37 +07:00
Windel Bouwman 85ae39f2e4 Merge pull request #1534 from RustPython/coolreader18/yieldfrom-fix
Fix the `yield from` expression
2019-10-17 07:15:44 +02:00
Johan 6270344740 Update isclose module of math (#1532)
- Implement `math.isclose()` function with test case
  - Add `IsCloseArgs` struct for `keyword_only` argument: `rel_tol`, `abs_tol`
- Change order of test case on `math_module.py` for readability
  - Clippy recommends using `std::f64::EPSILON` instead of `==` but purpose is different
- Fix multiline declaration on the function parameters
2019-10-16 23:25:53 +09:00
Jeong YunWon 4477e6725e Merge pull request #1528 from youknowone/module-error
Fix module attr error to use python `__name__` instead of rust struct `name`
2019-10-16 12:00:14 +09:00
coolreader18 672f146de4 Properly implement gen.throw() 2019-10-15 14:00:08 -05:00
Noah c31b3b2af9 Use the first arg of StopIteration as yield from return value 2019-10-15 13:58:08 -05:00