To select the (0,0,1) pointing face(s) attached to the currently selected edge, you could use code like this.
(See TextEditor->Templates->Python->Simple BMesh from editmode)
This script expects to be in Edit Mode with 1 edge selected.
import bpy
import bmesh
import mathutils
from mathutils import Vector
EPSILON = 1.0e-5
up_vector = Vector((0,0,1))
obj = bpy.context.edit_object
me = obj.data
bm = bmesh.from_edit_mesh(me)
edge = [e for e in bm.edges if e.select][0]
linked_faces = edge.link_faces
if linked_faces:
for f in linked_faces:
if (f.normal-up_vector).length < EPSILON:
f.select = True
bmesh.update_edit_mesh(me, True)
For simplicity i've limited the selected edges to the first, by doing [0], but you might want to add warning messages as part of your script to warn the user (mostly you) that you have more than one edge selected..
or if you do want to handle multiple selected edges
edges = [e for e in bm.edges if e.select]
for edge in edges:
linked_faces = edge.link_faces
if linked_faces:
for f in linked_faces:
if (f.normal-up_vector).length < EPSILON:
f.select = True
This won't take into account those edges that are hidden. their edge.hide attribute evaluates to True