forked from beeware/batavia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request beeware#535 from freakboy3742/master
Import antigravity
- Loading branch information
Showing
8 changed files
with
82 additions
and
12 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,13 @@ | ||
var hashlib = { | ||
'__doc__': '', | ||
'__file__': 'batavia/modules/hashlib.js', | ||
'__name__': 'hashlib', | ||
'__package__': '' | ||
} | ||
|
||
// hashlib.choice = function(choices) { | ||
// var index = Math.floor(Math.hashlib() * choices.length) | ||
// return choices[index] | ||
// } | ||
|
||
module.exports = hashlib |
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
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,46 @@ | ||
import unittest | ||
|
||
from ..utils import TranspileTestCase | ||
|
||
|
||
class HashlibTests: | ||
@unittest.expectedFailure | ||
def test_digest(self): | ||
self.assertCodeExecution(""" | ||
import hashlib | ||
m = hashlib.%s() | ||
m.update(b"Nobody inspects") | ||
m.update(b" the spammish repetition") | ||
print(m.digest()) | ||
""" % self.ALGORITHM) | ||
|
||
@unittest.expectedFailure | ||
def test_hexdigest(self): | ||
self.assertCodeExecution(""" | ||
import hashlib | ||
print(hashlib.%s(b"Nobody inspects the spammish repetition").hexdigest()) | ||
""" % self.ALGORITHM) | ||
|
||
|
||
class MD5Tests(TranspileTestCase, HashlibTests): | ||
ALGORITHM = 'md5' | ||
|
||
|
||
class SHA1Tests(TranspileTestCase, HashlibTests): | ||
ALGORITHM = 'sha1' | ||
|
||
|
||
class SHA224Tests(TranspileTestCase, HashlibTests): | ||
ALGORITHM = 'sha224' | ||
|
||
|
||
class SHA256Tests(TranspileTestCase, HashlibTests): | ||
ALGORITHM = 'sha256' | ||
|
||
|
||
class SHA384Tests(TranspileTestCase, HashlibTests): | ||
ALGORITHM = 'sha384' | ||
|
||
|
||
class SHA512Tests(TranspileTestCase, HashlibTests): | ||
ALGORITHM = 'sha512' |
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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import unittest | ||
from ..utils import TranspileTestCase | ||
|
||
import random | ||
|
||
class RandomTests(unittest.TestCase): | ||
|
||
class RandomTests(TranspileTestCase): | ||
def test_choice(self): | ||
numbers = [1, 2, 3, 4, 5, 6, 7, 8] | ||
random_number = random.choice(numbers) | ||
self.assertIn(random_number, numbers) | ||
self.assertCodeExecution(""" | ||
import random | ||
numbers = [1, 2, 3, 4, 5, 6, 7, 8] | ||
random_number = random.choice(numbers) | ||
self.assertIn(random_number, numbers) | ||
""") |
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
from ..utils import ModuleFunctionTestCase, TranspileTestCase | ||
from ..utils import TranspileTestCase | ||
|
||
class Base64Tests(ModuleFunctionTestCase, TranspileTestCase): | ||
class WebbrowserTests(TranspileTestCase): | ||
def test_import(self): | ||
self.assertCodeExecution("import webbrowser") | ||
self.assertCodeExecution(""" | ||
import webbrowser | ||
""") | ||
|
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