def smoke_test_element_creation():
    # grab the set of elements represented by 'Z'
    elements = sorted([elm for abbrev, elm in six.iteritems(basic)
                       if isinstance(abbrev, int)])

    for e in elements:
        sym = e.sym
        name = e.name
        # make sure that the elements can be initialized with Z or any
        # combination of element symbols or the element name
        inits = [sym, sym.upper(), sym.lower(), sym.swapcase(), name,
                 name.upper(), name.lower(), name.swapcase()]
        # loop over the initialization routines to smoketest element creation
        for init in inits:
            elem = BasicElement(init)

        # create an element with the Z value
        elem = BasicElement(e.Z)
        str(elem)
        # obtain all attribute fields of the Element to ensure it is
        # behaving correctly
        for field in element._fields:
            tuple_attr = getattr(basic[e.Z], field)
            elem_attr_dct = elem[str(field)]
            elem_attr = getattr(elem, field)
            # shield the assertion from any elements whose density is
            # unknown
            try:
                if np.isnan(tuple_attr):
                    continue
            except __HOLE__:
                pass
            assert_equal(elem_attr_dct, tuple_attr)
            assert_equal(elem_attr, tuple_attr)
            assert_equal(elem_attr_dct, elem_attr)

    # test the comparators
    for e1, e2 in zip(elements, elements[1:]):
        # compare prev_element to element
        assert_equal(e1.__lt__(e2), True)
        assert_equal(e1 < e2, True)
        assert_equal(e1.__eq__(e2), False)
        assert_equal(e1 == e2, False)
        assert_equal(e1 >= e2, False)
        assert_equal(e1 > e2, False)
        # compare element to prev_element
        assert_equal(e2 < e1, False)
        assert_equal(e2.__lt__(e1), False)
        assert_equal(e2 <= e1, False)
        assert_equal(e2.__eq__(e1), False)
        assert_equal(e2 == e1, False)
        assert_equal(e2 >= e1, True)
        assert_equal(e2 > e1, True)
dataset/ETHPy150Open scikit-beam/scikit-beam/skbeam/core/constants/tests/test_basic.py/smoke_test_element_creation