-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jackusay
committed
May 1, 2023
1 parent
7734a3f
commit d7da58b
Showing
2 changed files
with
31 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
id_img = image_proc(0, IMAGE_CREATE) | ||
|
||
def log(s): | ||
print(s) | ||
#print(s) | ||
pass | ||
|
||
def get_url(txt): | ||
|
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,30 @@ | ||
import unittest | ||
#from . import __init__ as home #error | ||
#from . import __init__ #error | ||
#from . import init #error | ||
#from __init__ import get_url #error | ||
#from .mdimg import * #error | ||
from cuda_markdown_image.__init__ import get_url | ||
#if use exec(open("filename.py").read()) to execute script, import part need to use absolute path!!! | ||
|
||
|
||
class GetUrlTestCase(unittest.TestCase): | ||
def test_get_url(self): | ||
expected = r"https://octodex.github.com/images/stormtroopocat.jpg" | ||
result = get_url(r'some idea ![Stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat") do it.') | ||
self.assertEqual(result, expected) | ||
def test_get_url_include_space(self): | ||
expected = r"https://octodex.github.com/Ims/ca t" | ||
result = get_url(r'some idea ![Stocat](https://octodex.github.com/Ims/ca t "The Storocat") do it.') | ||
self.assertEqual(result, expected) | ||
def test_get_url_include_backslash(self): | ||
expected = r"C:\Users\Downloads\New folder\cuda_hilite" | ||
result = get_url(r'some idea ![Stocat](C:\Users\Downloads\New folder\cuda_hilite "The Storocat") do it.') | ||
self.assertEqual(result, expected) | ||
|
||
suite = unittest.TestSuite() | ||
suite.addTest(GetUrlTestCase('test_get_url')) | ||
suite.addTest(GetUrlTestCase('test_get_url_include_space')) | ||
suite.addTest(GetUrlTestCase('test_get_url_include_backslash')) | ||
|
||
unittest.TextTestRunner(verbosity=2).run(suite) |