-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into go-test-test
- Loading branch information
Showing
8 changed files
with
51 additions
and
53 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 @@ | ||
3.5.9 |
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
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,36 +1,38 @@ | ||
from nose.tools import eq_ | ||
from unittest import TestCase | ||
from launchable.commands.verify import * | ||
|
||
def test_compare_version(): | ||
def sign(x): | ||
if x<0: | ||
return -1 | ||
if x>0: | ||
return 1 | ||
return 0 | ||
|
||
def f(expected, a,b): | ||
"""Ensure symmetry on two sides""" | ||
eq_(sign(compare_version(a,b)), expected) | ||
eq_(sign(compare_version(b,a)), -expected) | ||
class VersionTest(TestCase): | ||
def test_compare_version(self): | ||
def sign(x): | ||
if x<0: | ||
return -1 | ||
if x>0: | ||
return 1 | ||
return 0 | ||
|
||
f(0, [1, 1, 0], [1, 1]) # 1.1.0 = 1.1 | ||
f(1, [1, 1], [1, 0]) # 1.1 > 1.0 | ||
f(1, [1, 0, 1], [1]) # 1.0.1 > 1 | ||
def f(expected, a,b): | ||
"""Ensure symmetry on two sides""" | ||
self.assertEqual(sign(compare_version(a,b)), expected) | ||
self.assertEqual(sign(compare_version(b,a)), -expected) | ||
|
||
def test_java_version(): | ||
assert compare_java_version( | ||
""" | ||
java version "1.8.0_144" | ||
Java(TM) SE Runtime Environment (build 1.8.0_144-b01) | ||
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode) | ||
""" | ||
) >= 0 | ||
f(0, [1, 1, 0], [1, 1]) # 1.1.0 = 1.1 | ||
f(1, [1, 1], [1, 0]) # 1.1 > 1.0 | ||
f(1, [1, 0, 1], [1]) # 1.0.1 > 1 | ||
|
||
assert compare_java_version( | ||
""" | ||
java version "1.5.0_22" | ||
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03) | ||
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_22-b03, mixed mode) | ||
""" | ||
) < 0 | ||
def test_java_version(self): | ||
self.assertTrue(compare_java_version( | ||
""" | ||
java version "1.8.0_144" | ||
Java(TM) SE Runtime Environment (build 1.8.0_144-b01) | ||
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode) | ||
""" | ||
) >= 0) | ||
|
||
self.assertTrue(compare_java_version( | ||
""" | ||
java version "1.5.0_22" | ||
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03) | ||
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_22-b03, mixed mode) | ||
""" | ||
) < 0) |
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,11 +1,12 @@ | ||
from click.testing import CliRunner | ||
from launchable.__main__ import main | ||
from launchable.version import __version__ | ||
from nose.tools import eq_ | ||
from unittest import TestCase | ||
|
||
|
||
def test_version(): | ||
runner = CliRunner() | ||
result = runner.invoke(main, ['--version']) | ||
eq_(result.exit_code, 0) | ||
eq_(result.output, 'launchable-cli, version {}\n'.format(__version__)) | ||
class VersionTest(TestCase): | ||
def test_version(self): | ||
runner = CliRunner() | ||
result = runner.invoke(main, ['--version']) | ||
self.assertEqual(result.exit_code, 0) | ||
self.assertEqual(result.output, 'launchable-cli, version {}\n'.format(__version__)) |
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,11 @@ | ||
from launchable.utils.gzipgen import compress | ||
from nose.tools import eq_ | ||
import gzip | ||
from unittest import TestCase | ||
|
||
def test_compress(): | ||
"""Basic sanity test of """ | ||
encoded=b''.join(compress([b'Hello',b' ',b'world'])) | ||
msg = gzip.decompress(encoded) | ||
print(msg) | ||
eq_(msg,b'Hello world') | ||
class GzippenTest(TestCase): | ||
def test_compress(self): | ||
"""Basic sanity test of """ | ||
encoded=b''.join(compress([b'Hello',b' ',b'world'])) | ||
msg = gzip.decompress(encoded) | ||
print(msg) | ||
self.assertEqual(msg, b'Hello world') |