mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-04-29 03:00:14 -04:00
Testing/utils (#548)
* New unittest for utils.py Unit test fetch in basic ways. Would have tested more fetches, but downloading stuff for tests is annoying and mocking is more dependencies. * Remove unused imports
This commit is contained in:
15
test/test_utils.py
Normal file
15
test/test_utils.py
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python
|
||||
import unittest
|
||||
from extra.utils import fetch
|
||||
|
||||
class TestUtils(unittest.TestCase):
|
||||
def test_fetch_bad_http(self):
|
||||
self.assertRaises(AssertionError, fetch, 'http://httpstat.us/500')
|
||||
self.assertRaises(AssertionError, fetch, 'http://httpstat.us/404')
|
||||
self.assertRaises(AssertionError, fetch, 'http://httpstat.us/400')
|
||||
|
||||
def test_fetch_small(self):
|
||||
assert(len(fetch('https://google.com'))>0)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user