mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-24 14:28:09 -05:00
* 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
15 lines
478 B
Python
15 lines
478 B
Python
#!/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() |