from __future__ import division
from utils import absolute_magnitude, plDensity, hz


def test_absolute_magnitude():
    m = 10
    assert isinstance(absolute_magnitude(1, 1), float)
    assert absolute_magnitude(1, m) > m
    assert absolute_magnitude(1, m) == 15
    assert absolute_magnitude(0.1, m) == m
    assert absolute_magnitude(0.01, m) < m
    assert absolute_magnitude(1/10, m) == m


def test_plDensity():
    m, r = 1, 1
    assert isinstance(plDensity(m, r), float)
    assert round(plDensity(m, r), 2) == 1.33
    assert plDensity(0, r) == 0


def test_hz():
    teff = 5777
    lum = 1
    for model in range(1, 6):
        assert isinstance(hz(teff, lum, model), float)
    results = [0.75, 0.98, 0.99, 1.71, 1.77]
    for model, result in enumerate(results, start=1):
        assert round(hz(teff, lum, model), 2) == result

from __future__ import division
import pytest
import pandas as pd
from utils import absolute_magnitude, plDensity, hz, readSC


def test_absolute_magnitude():
    m = 10
    assert isinstance(absolute_magnitude(1, 1), float)
    assert absolute_magnitude(1, m) > m
    assert absolute_magnitude(1, m) == 15
    assert absolute_magnitude(0.1, m) == m
    assert absolute_magnitude(0.01, m) < m
    assert absolute_magnitude(1/10, m) == m
    with pytest.raises(ZeroDivisionError):
        absolute_magnitude(0, m)


def test_plDensity():
    m, r = 1, 1
    assert isinstance(plDensity(m, r), float)
    assert round(plDensity(m, r), 2) == 1.33
    assert plDensity(0, r) == 0


def test_hz():
    teff = 5777
    lum = 1
    for model in range(1, 6):
        assert isinstance(hz(teff, lum, model), float)
    results = [0.75, 0.98, 0.99, 1.71, 1.77]
    for model, result in enumerate(results, start=1):
        assert round(hz(teff, lum, model), 2) == result
    assert hz(teff, lum, 2) < hz(teff, lum, 4)  # hz1 < hz2


def test_readSC():
    df, plot_names = readSC()
    assert isinstance(df, pd.DataFrame)    #
    assert isinstance(plot_names, list)
    for name in plot_names:
        assert isinstance(name, str)

Add couple more utils tests.
Add couple more utils tests.

  from __future__ import division
+ import pytest
+ import pandas as pd
- from utils import absolute_magnitude, plDensity, hz
+ from utils import absolute_magnitude, plDensity, hz, readSC
  
  
  def test_absolute_magnitude():
      m = 10
      assert isinstance(absolute_magnitude(1, 1), float)
      assert absolute_magnitude(1, m) > m
      assert absolute_magnitude(1, m) == 15
      assert absolute_magnitude(0.1, m) == m
      assert absolute_magnitude(0.01, m) < m
      assert absolute_magnitude(1/10, m) == m
+     with pytest.raises(ZeroDivisionError):
+         absolute_magnitude(0, m)
  
  
  def test_plDensity():
      m, r = 1, 1
      assert isinstance(plDensity(m, r), float)
      assert round(plDensity(m, r), 2) == 1.33
      assert plDensity(0, r) == 0
  
  
  def test_hz():
      teff = 5777
      lum = 1
      for model in range(1, 6):
          assert isinstance(hz(teff, lum, model), float)
      results = [0.75, 0.98, 0.99, 1.71, 1.77]
      for model, result in enumerate(results, start=1):
          assert round(hz(teff, lum, model), 2) == result
+     assert hz(teff, lum, 2) < hz(teff, lum, 4)  # hz1 < hz2
  
+ 
+ def test_readSC():
+     df, plot_names = readSC()
+     assert isinstance(df, pd.DataFrame)    #
+     assert isinstance(plot_names, list)
+     for name in plot_names:
+         assert isinstance(name, str)
+ 
Add couple more utils tests.
## Code Before:
from __future__ import division
from utils import absolute_magnitude, plDensity, hz


def test_absolute_magnitude():
    m = 10
    assert isinstance(absolute_magnitude(1, 1), float)
    assert absolute_magnitude(1, m) > m
    assert absolute_magnitude(1, m) == 15
    assert absolute_magnitude(0.1, m) == m
    assert absolute_magnitude(0.01, m) < m
    assert absolute_magnitude(1/10, m) == m


def test_plDensity():
    m, r = 1, 1
    assert isinstance(plDensity(m, r), float)
    assert round(plDensity(m, r), 2) == 1.33
    assert plDensity(0, r) == 0


def test_hz():
    teff = 5777
    lum = 1
    for model in range(1, 6):
        assert isinstance(hz(teff, lum, model), float)
    results = [0.75, 0.98, 0.99, 1.71, 1.77]
    for model, result in enumerate(results, start=1):
        assert round(hz(teff, lum, model), 2) == result

## Instruction:
Add couple more utils tests.
## Code After:
from __future__ import division
import pytest
import pandas as pd
from utils import absolute_magnitude, plDensity, hz, readSC


def test_absolute_magnitude():
    m = 10
    assert isinstance(absolute_magnitude(1, 1), float)
    assert absolute_magnitude(1, m) > m
    assert absolute_magnitude(1, m) == 15
    assert absolute_magnitude(0.1, m) == m
    assert absolute_magnitude(0.01, m) < m
    assert absolute_magnitude(1/10, m) == m
    with pytest.raises(ZeroDivisionError):
        absolute_magnitude(0, m)


def test_plDensity():
    m, r = 1, 1
    assert isinstance(plDensity(m, r), float)
    assert round(plDensity(m, r), 2) == 1.33
    assert plDensity(0, r) == 0


def test_hz():
    teff = 5777
    lum = 1
    for model in range(1, 6):
        assert isinstance(hz(teff, lum, model), float)
    results = [0.75, 0.98, 0.99, 1.71, 1.77]
    for model, result in enumerate(results, start=1):
        assert round(hz(teff, lum, model), 2) == result
    assert hz(teff, lum, 2) < hz(teff, lum, 4)  # hz1 < hz2


def test_readSC():
    df, plot_names = readSC()
    assert isinstance(df, pd.DataFrame)    #
    assert isinstance(plot_names, list)
    for name in plot_names:
        assert isinstance(name, str)
