Zonghan, Xie

@zonghan

Joined on Aug 21, 2016

  • Maxwell's equation $\nabla \times {\mathbf{E}(\mathbf{x},t)} = -\frac{\partial \mathbf{B}(\mathbf{x},t)}{\partial t}$ $\nabla \times {\mathbf{H}(\mathbf{x},t)} = \mathbf{J}(\mathbf{x},t) +\frac{\partial \mathbf{D}(\mathbf{x},t)}{\partial t}$ Consider inhomogenoues, isotropic material. ${\mathbf{D}(\mathbf{x},t)}={\epsilon(\mathbf{x})}{\mathbf{E}(\mathbf{x},t)}$ ${\mathbf{B}(\mathbf{x},t)}={\mu(\mathbf{x})}{\mathbf{H}(\mathbf{x},t)}$ 3-D
     Like  Bookmark
  • --- title: Pytest 101 tags: python, pytest, test, unit test description: --- # Pytest 101 Speaker: Zong-han, Xie https://hackmd.io/PdkOGp6NQDWJVLCxz06vWg --- # Disclaimer --- ~~Spaker only has written almost no test in his projects.~~ --- ## Installation of pytest ```bash conda install pytest ``` or ```bash pip install pytest ``` --- ## First test example --- 1. create a function with the test_ prefix ```python def inc(x): return x + 1 def test_answer(): assert inc(3) ==
     Like  Bookmark
  • --- tags: python, pytest --- # pytest ## code #### basic ``` code=python def inc(x): return x + 1 def test_answer(): assert inc(3) == 4 ``` #### dynamically adding parameters ##### `simple2.py` ``` code=python import argparse def test_answer(cmdopt): if cmdopt == 'type1': print('first') elif cmdopt == 'type2': print('second') assert 0 ``` ##### `conftest.py` ```code=python import pytest def pytest_addoption(parser): parser.addoption( "--cmd
     Like  Bookmark