Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
 def test_okay_differing_types2(self):
     assert_dict_almost_equal({'a': 1}, {'a': 1.})
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
 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")
Ejemplo n.º 6
0
 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")
Ejemplo n.º 7
0
 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})
Ejemplo n.º 8
0
 def test_wrong_keys(self):
     try:
         assert_dict_almost_equal({'a': 1}, {'a': 1, 'b': 2})
         assert False
     except AssertionError:
         pass
Ejemplo n.º 9
0
 def test_okay_differing_types2(self):
     assert_dict_almost_equal({'a': 1}, {'a': 1.})
Ejemplo n.º 10
0
 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")
Ejemplo n.º 11
0
 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")
Ejemplo n.º 12
0
 def test_wrong_keys(self):
     try:
         assert_dict_almost_equal({'a': 1}, {'a': 1, 'b': 2})
         assert False
     except AssertionError:
         pass
Ejemplo n.º 13
0
 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})