Skip to content

Commit

Permalink
Factory func tests for other XML elements
Browse files Browse the repository at this point in the history
  • Loading branch information
abelcheung committed Mar 27, 2023
1 parent 6fbfe48 commit 9bb1e9b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test-data/test-etree-element.yml
Original file line number Diff line number Diff line change
Expand Up @@ -434,3 +434,26 @@
el.xpath(path=s) # ER: Too few arguments.* \[call-arg]$
el.xpath(s, namespaces=badns) # ER: Argument "namespaces" .+; expected ".+" \[arg-type]$
el.xpath(s, extensions=badext) # ER: Argument "extensions" .+; expected ".+" \[arg-type]$
- case: other_factories
main: |
from lxml import etree as e
s: str
comm = e.Comment()
reveal_type(comm) # NR: .+ "[\w\.]+\._Comment"$
e.Comment(s)
e.Comment(1) # ER: Argument 1 .+; expected ".+" \[arg-type]$
e.Comment(s, s) # ER: Too many arguments .+ \[call-arg]$
ent = e.Entity(s)
reveal_type(ent) # NR: .+ "[\w\.]+\._Entity"$
e.Entity() # ER: Missing positional argument .+ \[call-arg]$
e.Entity(1) # ER: Argument 1 .+; expected ".+" \[arg-type]$
e.Entity(s, s) # ER: Too many arguments .+ \[call-arg]$
pi = e.ProcessingInstruction(s)
reveal_type(pi) # NR: .+ "[\w\.]+\._ProcessingInstruction"$
e.ProcessingInstruction() # ER: Missing positional argument .+ \[call-arg]$
e.ProcessingInstruction(1) # ER: Argument 1 .+; expected ".+" \[arg-type]$
e.ProcessingInstruction(s, 1) # ER: Argument 2 .+; expected ".+" \[arg-type]$
e.ProcessingInstruction(s, s, 1) # ER: Too many arguments .+ \[call-arg]$

0 comments on commit 9bb1e9b

Please sign in to comment.