def test_angles_to_hkl(): hkl_calc, param_calc = dc.angles_to_hkl(angles, en) aneq_(hkl_calc, [1, 0, 0]) assert_dict_almost_equal(param_calc, param)
def test_hkl_to_angles(): dc.con('a_eq_b') h, k, l = [1, 0, 0] angles_calc, param_calc = dc.hkl_to_angles(h, k, l, en) aneq_(angles_calc, angles) assert_dict_almost_equal(param_calc, param)
def test_okay_differing_types2(self): assert_dict_almost_equal({'a': 1}, {'a': 1.})
def test_angles_to_hkl_bypassing_hardware_plugin(): hkl_calc, param_calc = dc.angles_to_hkl(angles, en) aneq_(hkl_calc, [1, 0, 0]) assert_dict_almost_equal(param_calc, param)
def test_wrong_int(self): try: assert_dict_almost_equal({'a': 1}, {'a': 2}) assert False except AssertionError, e: eq_(e.args[0], "For key 'a', 1 != 2")
def test_wrong_float3(self): try: assert_dict_almost_equal({'a': 1.}, {'a': 2}) assert False except AssertionError, e: eq_(e.args[0], "For key 'a', 1.0 != 2 within 7 places")
def test__passes(self): assert_dict_almost_equal({}, {}) assert_dict_almost_equal({'a': 1}, {'a': 1}) assert_dict_almost_equal({'a': 1.}, {'a': 1.}) assert_dict_almost_equal({'a': 1.00000001}, {'a': 1.00000001})
def test_wrong_keys(self): try: assert_dict_almost_equal({'a': 1}, {'a': 1, 'b': 2}) assert False except AssertionError: pass