Testing/utils
* 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
MODIFY
models/resnet.py
models/resnet.py
from tinygrad.tensor import Tensor
import tinygrad.nn as nn
-from extra.utils import fetch, fake_torch_load, get_child
+from extra.utils import get_child
import numpy as np
class BasicBlock:

ADD
test/test_utils.py
+#!/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()
\ No newline at end of file

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